“不可能推送参考"当推入一个空的git repo时 [英] "Impossible to push references" when pushing into an empty git repo
问题描述
我正在尝试从git项目中获取一个分支并将其放入另一个git repo中,但是当我这样做并尝试推送时,我遇到了这个错误
I'm trying to get a branch from a git project and put it into another git repo however when I do this and trying to push I have this error
源引用说明符refs/heads/master不对应任何引用错误:无法将引用推送到原始"
the source reference specifier refs/heads/master does not correspond to any reference error: impossible to push references to "origin"
我还注意到,空项目甚至没有主项目就没有分支.
Also I've noticed that the empty project has no branch even the master one.
推荐答案
如果您已经克隆了第一个项目,并且想将分支推送到第二个远程 empty 存储库(无提交),则可以会做到:
If you have cloned the first project, and want to push a branch to a second remote empty repository (no commits), you would do:
cd /path/to/cloned/first/project
git remote add second https://url/second/empty/repository
git switch <theCorrectBranch>
git push -u second <theCorrectBranch>:main
这会将< theCorrectBranch>
推送到第二个远程空存储库的分支主体.
That would push <theCorrectBranch>
to the branch main of the second remote empty repository.
这篇关于“不可能推送参考"当推入一个空的git repo时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!