【发布时间】:2019-12-24 14:28:33
【问题描述】:
我在 GitLab 上有一个存储库,我也在 GitHub 上发布了它。
到目前为止,我使用的所有 Git 命令都在 GitLab 上进行更改。但是,我希望将这些提交放在 GitHub 上。
我试过命令:
git remote set-url origin git@github.com:repo-url
有人可以建议我如何设置 URL,以便命令可以在 GitHub 而不是 GitLab 上运行吗?
【问题讨论】:
-
git remote set-url origin <new-url>是更改远程地址的正确命令。如果您更喜欢使用 ssh,请将 new-url 设置为git@github.com:USERNAME/REPOSITORY.git格式。对于 https,它看起来像这样https://github.com/USERNAME/REPOSITORY.git
标签: git git-push git-pull git-remote git-fetch