Skip to content

Git:Troubleshooting:Push

Push명령어 도중 발생되는 문제점에 대하여 정리한다.

fatal: The remote end hung up unexpectedly

소스 파일 사이즈보다 postBuffer 사이즈가 작은 것이 문제였다. git config 커맨드로 http.postBuffer 사이즈를 늘려주면 간단하게 해결할 수 있다.

$ git config http.postBuffer 104857600

No refs in common and none specified; doing nothing

아래와 같은 에러가 발생할 수 있다. 맨 처음 git repository로 push할 때 발생한다. 처음 위치를 어디로 정해야 할지를 얘기해달라는 것이다. master로 넣을지..

$ git push 
No refs in common and none specified; doing nothing. 
Perhaps you should specify a branch such as 'master'. 
fatal: The remote end hung up unexpectedly 
error: failed to push some refs to ‘git 주소’

다음과 같이 origin master 를 추가해서 push하면 된다.

$ git push origin master

receive.denyCurrentBranch

이 문제는 여기서 생성한 git 저장소가 bare 저장소가 아니기 때문에 발생한 오류이다.

우리가 일반적으로 보는 저장소는 non-bare 저장소인데 파일 수정들의 작업을 하는 워킹 디렉토리가 있는 저장소가 non-bare 저장소이고 bare 저장소는 워킹디렉토리 없이 변경사항만 관리하게 된다.

이 문제를 해결하려면:

  • 원격지 저장소를 Bare 로 만들거나,
  • Non-bare 저장소 (즉 원격지) 에서 git config receive.denyCurrentBranch ignore을 실행해서 현재 브랜치에서 푸시를 받도록 설정하면 정상적으로 푸시를 할 수 있다.

Agreeing to the Xcode/iOS license requires admin privileges

push명령 도중 아래와 같은 에러가 발생될 수 있다.

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

이 경우 아래의 명령으로 라이선스에 동의해야 한다.

$ sudo xcodebuild -license

HTTP 413 curl 22 The requested URL returned error

$ git push -v

다음과 같은 에러가 발생할 수 있다.

Pushing to https://git.server-project.com/blackhole/opm.git
Enumerating objects: 79, done.
Counting objects: 100% (79/79), done.
Delta compression using up to 8 threads
Compressing objects: 100% (68/68), done.
POST git-receive-pack (chunked)
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
fatal: the remote end hung up unexpectedly
Writing objects: 100% (69/69), 4.82 MiB | 4.59 MiB/s, done.
Total 69 (delta 35), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

서버에 전송 가능한 Body 크기(Content-Length) 제한이 걸려있다. 이 값을 늘려야 한다. Gitlab#HTTP 413 curl 22 The requested URL returned error 항목 참조.

By default, updating the current branch in a non-bare repository is denied

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 419 bytes | 419.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: error: refusing to update checked out branch: refs/heads/main
remote: error: By default, updating the current branch in a non-bare repository
remote: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://192.168.1.88/home/geosoft/Project/faivv-resource-monitoring-service
 ! [remote rejected] main -> main (branch is currently checked out)
error: failed to push some refs to 'ssh://192.168.1.88/home/geosoft/Project/faivv-resource-monitoring-service'

#receive.denyCurrentBranch 항목 참조.

See also