Git Tip: git push ‘No refs in common and none specified’

Git is a source-control tool used by software developers.

I recently switched from Subversion to Git and while things have been mostly smooth, there have been a few “WTF?” moments. I am going to try and blog the few beginner ones I ran into in hopes of helping anyone else.

Today I ran a ‘git push’ to shove my commits from my local repository back into the main remote repo, the result was this:

$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
error: failed to push some refs to '<repo>.git'

The odd bit is that I had just done this with a previous repo about 30 mins ago and it worked fine; this was a new repository I was setting up. As it turns out this is the result of originally cloning an empty repository (link, link) which is exactly what I did. I had created a new repo on GitHub and wanted to pull the repo down in IntelliJ to then add some files to it via the GUI instead of from the command line; so I had checked out the empty repo right after creating it.

The fix, fortunately, is dead easy:

$ git push origin master

Doing this should provide output like:

$ git push origin master
Counting objects: 568, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (559/559), done.
Writing objects: 100% (568/568), 2.28 MiB | 2.18 MiB/s, done.
Total 568 (delta 205), reused 0 (delta 0)
* [new branch]      master -> master

It is my understanding that the core issue is that there are no files in common between the original remote repo you cloned (empty) and the one on-disk (now full of files). Doing the git-push-origin-master shoves your repo up into the empty repository and gives you that common base again so you can do a ‘git push‘ without issue.

Happy Git’ing!

, , , , , ,

45 Responses to Git Tip: git push ‘No refs in common and none specified’

  1. James June 14, 2010 at 1:55 am #

    Thanks for the tip – it worked, and you’ve just saved me some hassle!

  2. James July 1, 2010 at 2:29 pm #

    Thanks for this. I would have been scratching my head for a while over this one…

  3. Mikko November 11, 2010 at 2:45 pm #

    Thanks for helping me out!

  4. René February 17, 2011 at 8:53 am #

    Thank you, saved me a lot of time!

  5. CXJ April 5, 2011 at 9:21 am #

    Thank you so much for posting this. It saved me a bunch of time. This is one of several really dumb design decisions in Git that just drive me batty.

    • Johan August 31, 2012 at 6:17 am #

      They are not DUMB, its you that won’t spend some time learning it.

  6. bp August 23, 2011 at 11:31 am #

    thanks, this helped!

  7. Cal Leeming September 15, 2011 at 12:48 pm #

    Thank you for this – Quick google search brought this up, and this fixed it :) <3

    • Riyad Kalla September 17, 2011 at 9:23 am #

      Excellent, that’s exactly what I was hoping for.

  8. aerozeppelin November 11, 2011 at 2:29 pm #

    Thank you. This was soo Useful!

  9. Ken Lai November 16, 2011 at 7:28 pm #

    Thanks, it worked for me. It’s really dead easy :p

  10. Nick Kaye November 23, 2011 at 10:56 pm #

    I love your intro, “there have been a few WTF moments” since I switched from SVN to Git. I tried your fix and got:

    error: src refspec master does not match any.

    Still scratching my head; a portion of my skull is missing! Especially puzzled that I’m the only one for whom your dead easy fix did not work. Holler if the above error is familiar to anyone else!

  11. Nick Kaye November 23, 2011 at 10:59 pm #

    Follow-up, in case I’m not the only person on the internet missing a portion of my skull. The answer, for me, came by literally just following the directions github provides for gits just like myself. DON’T clone the empty repository. Just go to your linux shell and try:

    mkdir api-test
    cd api-test
    git init
    touch README
    git add README
    git commit -m ‘first commit’
    git remote add origin
    git push -u origin master

    • Riyad Kalla November 24, 2011 at 6:07 am #

      haha, Nick thank you for the followup. I know it will help a number of folks that end up here via search that have scratched portions of their scalps away :)

      • nik January 24, 2012 at 9:10 am #

        Indeed, thank you :).

    • Ahmed November 18, 2013 at 4:52 am #

      Awesome Nick! Thank you so much – was banging my skull for a long time :)

  12. Shane February 2, 2012 at 8:55 am #

    You saved my @ss thank man!

  13. Andrew Waite February 28, 2012 at 10:13 am #

    Thanks for sharing,

    such a simple issue when you know how, but kept me stumped for a while until I came across this post.

    New to git and still getting my feet wet.

  14. Ramya March 12, 2012 at 10:19 am #

    Thanks ..It helped me

  15. Sean March 20, 2012 at 10:33 am #

    Thanks very much, very helpful

  16. Juhani April 5, 2012 at 3:01 am #

    Thanks for posting this. Had the same problem and the same fix worked.

  17. berry May 5, 2012 at 1:53 pm #

    Thanks a lot !! .. it really helped

  18. Dario May 19, 2012 at 4:22 pm #


  19. jaime June 3, 2012 at 2:08 pm #

    you need a facebook like button to click it, thanks

  20. Andrea Grandi June 12, 2012 at 12:44 am #

    It just worked for me too, thank!

  21. JaredYe July 20, 2012 at 1:45 am #

    Thank you. It works for me

  22. AW September 2, 2012 at 10:23 pm #


  23. rich September 10, 2012 at 6:43 am #

    Helped me as well… thanks!

  24. evanthebouncy November 12, 2012 at 10:35 pm #

    much appreciated… first link on the error message on google.
    this is how programming with internet is suppose to be!!

  25. Espen pling plong November 23, 2012 at 8:30 am #

    Thanks a bunch! I’ve been scratching my head for the whole evening over this.


  26. pravsim December 7, 2012 at 4:29 am #

    thanks it worked

  27. Sharma December 17, 2012 at 12:26 pm #

    Thanks, it really helped :)

  28. Jeff Gardner June 13, 2013 at 9:02 pm #

    Awesome. Glad to know I’m not the only one who was stuck!

  29. Guilherme October 21, 2013 at 9:14 pm #

    Thank man!

  30. Sasha November 2, 2013 at 10:08 am #


  31. steph August 13, 2014 at 8:54 am #

    Thanks for the tip ! It was really helpful !

  32. スーパーコピー、スーパーコピーブランド(N級品)激安通販専門店世界一流ブランドコピー 財布、スーパーコピー 商品、激安ブランドコピー 。 ヴィトンコピー 、 ミョウミョウコピー 、シャネルコピー 、エル メスコピー 品格安通販。商品は全て最高な材料 と優れた技術で造られて、正規と比べて、品質が無差別です!人気ブランド..
    【新品】バッグ、財布、靴、帽子、アパレル、ベルト、その他小物 シャネル グッチ エルメス ロレックス ROLEX VUITTON CHANEL GUCCI HERMES ROLEX S級 VUITTON S級 CHANEL S GUCCI S級 HERMES S級 ROLEX AAA級 VUITTON AAA級 CHANEL AAA級 GUCCI AAA級 HERMES AAA級品 N級品ルイ ヴィトンS級品 シャネルS級品 グッチS級品 エルメスS級品 ロレックスS級品 ルイ ヴィトンAAA級品 シャネルAAA級品 グッチAAA級品 エルメスAAA級品 ロレックスAAA級品 ブランド バッグ 激安!! ブランド 財布 激安!! ブランド品を激安価格にて販売しております。 S級品 ブランド激安!! ブランド S級品激安!! AAA級 ブランド 激安!! ブランド 腕時計 激安!! S級品ブランド バッグ 激安!! S級品ブランド 財布 激安!! ルイヴィトンを激安で購入する方法 VUITTON財布を激安販売。 VUITTONバッグ 激安販売。 ヴィトン財布激安 S級ルイヴィトン財布 S級品ルイヴィトンバッグ ルイヴィトンバッグ激安!! ルイヴィトン財布激安!! ROLEX 腕時計激安!! CHANEL財布激安!! CHANELバッグ激安!! S級品 腕時計(Rolex)激安!! S級品 ブランド 腕時計 S級品ブランド 激安!! S級品ブランド 激安!!■スタイルが多い、品質がよい、価格が低い!■ 送料無料(日本全国) ご注文を期待しています!■信用第一、良い品質、低価格は■当社の商品は絶対の自信が御座います。激安、安心、安全にお届けします.品数豊富な商商品数も大幅に増え、品質も大自信です100%品質保証!満足保障!リピーター率100%!

  33. BVLGARI(バッグ?財布?小物)CHLOE(バッグ?財布、小物)偽物ブランド,激安,コピー?ルイヴィトンバッグ,偽物?ルイヴィトン財布,コピーバッグ,ブランドバッグ,偽物バッグ,偽物シャネルバッグ,偽物エルメスバッグ,偽物グッチバッグ,偽物財布,コピー財布,時計の專門店
    ロレックスコピー販売、代引きロレックス時計コピー通販、全て新品、高い品質、激安、送料無料。ロレックス時計コピーなど世界中有名なブランドレプリカを格安で通販しております。N級品スーパーコピーブランドは 業界で最高な品質に挑戦しますロレックコピー,ロレックコピー代引き,ロレック激安,ロレックス偽物 ,最高級ロレックコピーロレックス時計コピー,フェラーリコピー時計,パネライコピー時計,パテックフィリップコピー時計,ヴァシュロン.コンスタンタンコピー時計,エルメスコピー時計,カルティエコピー時計ルイヴィトンコピー、 ロレックスコピー、シャネルコピー、グッチコピー、エルメスコピー、 ボッテガヴェネタコピー、 バーバリーコピー、ミュウミュウコピー、トリーバーチコピー、バレンシアガコピー、ディオールコピー、ブルガリコピー、ブラダコピー、 ドルチェ&ガッバーナコピー、オメガコピー、フランク ミュラーコピー、gagaコピー。古驰拷贝, 靴/サンダル,サングラスコピー欧米O級品オーダー服各種のブランドの服、靴、、財布、腕時計の複製品をかばん一番ブランドliveブランドコピー服,ブランドバッグコピー,ブランド時計,ブランド靴シリーズ欧米O級品コーナーラッピング用品

  34. ┻┗┛┗┛%品質保証 満足保障。
    ブランドスーパーコピーバッグ、財布、時計プラダ スーパーコピー,プラダ 財布 コピー,プラダ 新作 財布ブランド財布コピー,ブランド スーパーコピー 財布,プラダ スーパーコピー 財布,シャネル財布コピールイヴィトン 財布 コピー,ルイヴィトン 財布 コピー 代引き,ルイヴィトン財布スーパーコピー,ルイヴィトン 財布 スーパーコピー 代引き,ヴィトン財布代引き,ヴィトン財布 人気,ヴィトン財布 激安,モノグラム 財布,マルチカラー 財布,ルイヴィトン財布新作,ルイヴィトン バッグ 新作,ルイヴィトン スーパーコピー 即日発送ルイヴィトン スーパーコピー 専門店ルイヴィトン スーパーコピー バッグルイヴィトン スーパーコピー 財布ルイヴィトン スーパーコピー 長財布2015年新作 ルイヴィトン スーパーコピールイヴィトン コピー,ルイヴィトン コピー 財布,ルイヴィトン コピー バッグ


  1. Git: git push -> No refs in common and none specified; doing nothing | Mitchell Fang's Coding - February 13, 2013

    […] thebuzzmedia […]

  2. git: some tricks | A sysadmin's logbook - May 21, 2013

    […] took some time and research to find out that the solution is a […]

  3. Git mini guida di sopravvivenza - September 13, 2014

    […] ovvero indicare che si sta lavorando nel branch master, una volta eseguito se lo ricorderà e basterà fare semplicemente git push, maggiori info le trovate qui: […]

Leave a Reply