No refs in common and none specified; doing nothin

2020-05-14 13:52发布

问题:

I had a local git project that I wanted to add to gitolite. Apparently this is hard so I abandoned the idea. I created a new gitolite repo by adding it to gitolite-admin/conf/gitolite.conf and committing and pushing the changes. Then I cloned the new repo with git clone git-noah:project-name successfully. I then copied all files and folders except .git to the project-name folder. I did,

git add -A
git commit -a -m "Moved to new repo."
git push

I get this error:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

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-noah:project-name'

回答1:

No master exists yet on the remote (origin) repository.

git push origin master

After this first push you can use the simpler

git push


回答2:

If you're using git to mirror then use this :

git config remote.backup.mirror true


回答3:

your master branch might be upstream and needs to be unset On branch master

Your branch is based on 'origin/master', but the upstream is gone. (use git branch --unset-upstream to fix)



回答4:

Your local and remote repositories do not share the same history, since you recreated the repo. Therefore, Git won't let you push this content.

If you are not afraid of losing the content that is on the remote repository, you can force push : git push -f.



标签: git gitolite