Solution: git push ‘No refs in common and none specified; doing nothing’

Solution: git push ‘No refs in common and none specified; doing nothing’

Git is another source control tool which is getting popular lately.

I am new to git and have been more used to using Subversion (svn). While working on a new git repository I came across the following error message when trying to push file to the repository.

[[email protected] some-repository]$ 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 ‘[email protected]:some-repository.git’

The problem with this repository here is that it is a brand new repository. I checked out an empty git repository and was adding file to it.

The git add and git commit were fine. However, when I did a git push I got the above mentioned error.

After working around on this I found the solution.

Solution: git push ‘No refs in common and none specified; doing nothing’

The solution for the above problem is pushing in git using the following command.

[[email protected] some-repository]$ git push origin master

So in my case the following is how it looked when I pushed the files in git.

[[email protected] some-repository]$ git push origin master
Counting objects: 8, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 2.72 KiB, done.
Total 8 (delta 0), reused 0 (delta 0)
To [email protected]:some-repository.git
 * [new branch]      master -> master

So the reason for this error to show up is that the empty git repository need to specify the origin and master. Once this is done, the subsequent git push to the repository will work fine.

2 Comments

  • Joe

    September 14, 2015 at 2:20 pm Reply

    Great! It saved my day!

  • osmjit

    September 17, 2015 at 4:11 pm Reply

    Error is due to no master branch and Git won’t commit empty directories. There must be files in the directories first.

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.