如何断开本地 git repo 与远程 master 的连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29583706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disconnect local git repo from remote master
提问by Cerin
How do I completely disconnect a local git repository from all remote branches?
如何完全断开本地 git 存储库与所有远程分支的连接?
I cloned a git repo from github.com, but then it was deleted and I don't want git to report any changes needing to be "pushed up". I've tried googling this, but I think my terminology is wrong, and I'm not finding anything.
我从 github.com 克隆了一个 git repo,但后来它被删除了,我不希望 git 报告任何需要“推送”的更改。我试过谷歌搜索这个,但我认为我的术语是错误的,我没有找到任何东西。
Can I simply delete the [remote "origin"]
and [branch "master"]
sections from my .git/config
file or will that break my local repo?
我可以简单地从我的文件中删除[remote "origin"]
和[branch "master"]
部分.git/config
还是会破坏我的本地存储库?
回答by helion3
git remote rm origin
should work.
git remote rm origin
应该管用。
回答by Vontei
This works:
这有效:
To remove a remote:
git remote remove origin
删除遥控器:
git remote remove origin
To add a remote:
git remote add origin yourRemoteUrl
& then git push -u origin master
添加遥控器:
git remote add origin yourRemoteUrl
&然后git push -u origin master
回答by DanGoodrick
If you remove the .git folder, it will disconnect your local repo from the remote.
如果删除 .git 文件夹,它将断开本地存储库与远程存储库的连接。
rm -rf path/to/local_repo/.git