Skip to content
Search

Git:Troubleshooting:Push

lastmod 2026-08-13created 2014-02-1613 edits

A summary of problems that occur during the Push command.

fatal: The remote end hung up unexpectedly

The problem was that the postBuffer size was smaller than the source file size. It can be easily fixed by increasing the http.postBuffer size with the git config command.

$ git config http.postBuffer 104857600

No refs in common and none specified; doing nothing

The following error may occur. It happens on the very first push to a git repository. Git is asking you to tell it where the initial location should be. Whether to put it in 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 주소’

Push with origin master added, as follows.

$ git push origin master

receive.denyCurrentBranch

This error occurs because the git repository created here is not a bare repository.

The repositories we usually see are non-bare repositories. A repository with a working directory where you modify files is a non-bare repository, while a bare repository manages only the changes, without a working directory.

To fix this problem:

  • Make the remote repository Bare, or
  • Run git config receive.denyCurrentBranch ignore in the Non-bare repository (i.e. the remote) so that it accepts pushes to the current branch; pushing will then work normally.

Agreeing to the Xcode/iOS license requires admin privileges

The following error may occur during the push command.

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

In this case, agree to the license with the following command.

$ sudo xcodebuild -license

HTTP 413 curl 22 The requested URL returned error

$ git push -v

The following error may occur.

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

The server limits the Body size (Content-Length) that can be sent. This value must be increased. See 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'

See #receive.denyCurrentBranch.

refusing to merge unrelated histories

C:\Users\gitProject>git push origin master
To https://github.com/userId/userProject.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/userId/userProject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Fixed with the following command:

git pull origin 브런치명 --allow-unrelated-histories

The --allow-unrelated-histories option is reportedly used in the rare situation of storing the histories of two existing projects. In other words, git by default refuses to merge two unrelated projects that share no history, and this option allows it.

See also

author Zer0 sitemap