git 没有共同的参考文献,也没有指定;什么也不做

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23528761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:04:31  来源:igfitidea点击:

No refs in common and none specified; doing nothing

gitgitolite

提问by Noah

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-namesuccessfully. I then copied all files and folders except .git to the project-name folder. I did,

我有一个本地 git 项目,我想将其添加到 gitolite。显然这很难,所以我放弃了这个想法。我通过将其添加到 gitolite-admin/conf/gitolite.conf 并提交和推送更改来创建一个新的 gitolite 存储库。然后我git clone git-noah:project-name成功地克隆了新的 repo 。然后我将除 .git 之外的所有文件和文件夹复制到项目名称文件夹中。我做了,

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'

回答by Oliver

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

远程(源)存储库中尚不存在 master。

git push origin master

After this first push you can use the simpler

在第一次推送之后,您可以使用更简单的

git push

回答by Struggler

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

如果您使用 git 进行镜像,请使用以下命令:

git config remote.backup.mirror true

回答by himanshuk

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

您的 master 分支可能位于上游,需要在分支 master 上取消设置

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

您的分支基于“origin/master”,但上游已经消失。(用于git branch --unset-upstream修复)

回答by Martin

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.

您的本地和远程存储库不共享相同的历史记录,因为您重新创建了存储库。因此,Git 不会让您推送此内容。

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

如果您不怕丢失远程存储库上的内容,则可以强制推送:git push -f