git 在 github 中重命名 repo 时出错,“远程:此存储库已移动。请使用新位置”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30443333/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:14:21  来源:igfitidea点击:

Error with renamed repo in github, "remote: This repository moved. Please use the new location"

git

提问by jamescampbell

I am receiving this notice: remote: This repository moved. Please use the new location [new location]when I push updates from my local instance to remote master on GitHub.

我收到此通知:remote: This repository moved. Please use the new location [new location]当我将更新从本地实例推送到 GitHub 上的远程主服务器时。

Is there a way to fix this?

有没有办法来解决这个问题?

回答by jamescampbell

The simple way is:

简单的方法是:

 git remote set-url origin [updated link url https://........git]

Alternatively, if you like the long way it is:

或者,如果你喜欢长路,它是:

 git remote rm origin
 git remote add origin [updated link]

Changing a remote's URLgithub documentation goes into further detail.

更改远程的 URLgithub 文档更详细。

回答by infinite-etcetera

To check the current one:

要检查当前的:

  git remote -v

Then to change it:

然后改变它:

  git remote set-url origin https://github.com/YOUR-USERNAME/YOUR-REPO.git