Why is old name of git remote sill in .git/refs/remotes?

巧了我就是萌 提交于 2019-12-06 12:00:34

问题


I recently moved my 'main' remote git repository from code.google to github. Then, I renamed old origin repo to code-google and previously created remote github to origin. So far so good.

But...

There are still references in .git/refs/remotes:

code-google  github  origin

I tried this, but it does not seem to be working:

$ git remote prune github --dry-run
fatal: 'github' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Why is github still there since it was renamed? Why am I not able to dispose of it? And how can I clean up my repo?


回答1:


This thread mentions that renaming the remote isn't enough:

If you want to be really complete, you should also delete your 'origin' refs :

rm -R .git/refs/remotes/origin

A safer way would be to clone your new remote repo (now on GitHub), and add another remote.



来源:https://stackoverflow.com/questions/14426231/why-is-old-name-of-git-remote-sill-in-git-refs-remotes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!