你能解释一下这个工作流程有什么问题吗?
$ git init --bare bare Initialized empty Git repository in /work/fun/git_experiments/bare/ $ git clone bare alice Cloning into alice... done. warning: You appear to have cloned an empty repository. $ cd alice/ $ touch a $ git add a $ git commit -m "Added a" [master (root-commit) 70d52d4] Added a 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a $ 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 '/work/fun/git_experiments/bare'
不git push总是推送到我克隆的存储库吗?
git push
是的,问题是“裸”中没有提交。如果您按顺序(裸露,爱丽丝)创建存储库,这仅是第一次提交的问题。尝试做:
git push --set-upstream origin master
这只需要第一次。之后它应该可以正常工作。
正如 Chris Johnsen 所指出的,如果您的 push.default 是自定义的,您将不会遇到这个问题。我喜欢上游/跟踪。