SVN迁移至Git推送裸仓库报错:No refs in common
Hey there, let's sort out this push error you're facing during your SVN-to-Git migration! That error message is Git's way of saying it doesn't know which branch you want to push, and right now your local repo and the bare repo don't share any common references. Here's how to fix it step by step:
First, confirm your local branches
Run this command to see what branches exist in your local migrated repo:git branch -aYou’ll likely see a
master(ormain, depending on your Git version setup) branch from your SVN migration work.Push your branch explicitly
Instead of just runninggit push bare, specify the exact branch you want to push. For example, if your main branch ismaster, use this command:git push bare master:masterThe
local-branch:remote-branchformat tells Git exactly which local branch to sync to which branch in the bare repository.Set an upstream branch for easier future pushes (optional)
If you want to skip specifying the branch every time, set up an upstream association between your local branch and the bare repo's branch:git branch --set-upstream-to=bare/master masterNow you can just run
git pushlater, and Git will automatically push your localmasterbranch to the bare repo'smasterbranch.
Quick sanity check: Double-check that your bare repository was created with git init --bare—if it was initialized as a regular non-bare repo, that could also cause unexpected push issues.
内容的提问来源于stack exchange,提问作者Manvi

