Why can't I push to this bare repository?

后端 未结 6 1941
生来不讨喜
生来不讨喜 2020-12-07 07:10

Can you explain what is wrong with this workflow?

$ git init --bare bare
Initialized empty Git repository in /work/fun/git_experiments/bare/
$ git clone bare         


        
6条回答
  •  独厮守ぢ
    2020-12-07 07:32

    Yes, the problem is that there are no commits in "bare". This is a problem with the first commit only, if you create the repos in the order (bare,alice). Try doing:

    git push --set-upstream origin master
    

    This would only be required the first time. Afterwards it should work normally.

    As Chris Johnsen pointed out, you would not have this problem if your push.default was customized. I like upstream/tracking.

提交回复
热议问题