git 没有共同参考文献,也没有具体说明;无所事事

8mmmxcuj  于 2023-08-01  发布在  Git
关注(0)|答案(7)|浏览(107)

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

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

字符串
我得到这个错误:

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'

czq61nw1

czq61nw11#

在远程(源)存储库上还不存在“main”。

git push origin main

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

git push

**编辑:**随着最近的趋势,我的答案已经更新,以取代“主”与“主”

y0u0uwnf

y0u0uwnf2#

如果收到错误:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch.

字符串
但未接收错误:

warning: push.default is unset


在尝试运行git push之前,请确保已运行git commit

toiithl6

toiithl63#

如果你使用git镜像,那么使用这个:

git config remote.backup.mirror true

字符串

dfddblmv

dfddblmv4#

您的master分支可能位于上游,需要在分支master上取消设置
你的分支是基于'origin/master'的,但是上游没有了。(使用git branch --unset-upstream进行修复)

omjgkv6w

omjgkv6w5#

在已接受的答案下面选择this user的评论。
我在使用fast-exporthg Mercurialrepo移动到GitLabrepo时遇到了这个错误,当时GitLab仓库已经在一段时间前创建了,并且仍然是空的。
错误的原因是新GitLab仓库的这个空框架已经构建了主分支应该被称为“master”的设置。这也是该消息所暗示的:Perhaps you should specify a branch such as 'master'.
在您的例子中,您可能有一个迁移工具,默认情况下将分支名称切换为main。在我的例子中,我已经将参数-M -main添加到fast-export命令中,将名称更改为现在更常见的main-然后与已经设置的GitLab存储库中所需的master冲突。
在git-repo文件夹中,我运行了(错!):

/data/fast-export/hg-fast-export.sh -r /data/hg-repo -A /data/authors --force -M -main

字符串
因此,我回到开始,在没有-M -main的情况下再次尝试:我删除了git-repo文件夹中的.git文件夹,再次运行git init my_git_repo,然后运行fast-export命令,而不运行-M -main。然后一切工作:我可以git checkout HEADgit remote add origin git@gitlab.com:my_project-url.gitgit branchgit push -u origin --allgit push -u origin --tags

wa7juj8i

wa7juj8i6#

对我来说,我有未提交的文件。
运行git status
已添加所有文件git add .
运行git push
然后,git push origin main或master

8nuwlpux

8nuwlpux7#

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

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

相关问题