作为 Coursera 数据科学家类(class)设置的一部分,我错误地将目录 test-repo 链接到错误的帐户。所以,在声明中:
git remote add origin https://github.com/yourUserNamehere/test-repo.git
我错误地指定了用户名。我在想我可以删除目录并重新设置它。我已经研究了删除目录或将其重新链接到正确帐户的能力,但没有找到任何可以帮助我这样做的信息。希望得到一些指导。
最佳答案
要更改 Remote 的 URL,请使用 git remote set-url <name> <newurl>
,
在你的例子中
git remote set-url origin https://github.com/yourUserNamehere/test-repo.git
按照@xwhyLikeThis 的评论中的建议移除 Remote 然后再次添加它也可以。
关于git - 将本地仓库链接到不正确的 github 帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30825987/