有没有办法在不同的用户名下从 vscode 推送到 github?

Is there a way to push from vscode to github under a different username?

我最近更改了我的用户名GitHub,但是我现在正在做的工作无法推送到旧名称,因为它是我以前的名字。我该如何解决?

error: failed to push some refs to 'git@github.com:old-username/repo.git'

有办法git push git@github.com:new-username/repo.git吗?谢谢

在命令行中,转到您的存储库文件夹并键入:

git remote set-url origin git@github.com:new-username/repo.git

然后再次打开您的 VSCode,看看它是否拾取新的 URL。