问题
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
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.
回答1:
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
That would push <theCorrectBranch> to the branch main of the second remote empty repository.
来源:https://stackoverflow.com/questions/65510951/impossible-to-push-references-when-pushing-into-an-empty-git-repo