GIT删除远程orgin存储库,并更改默认存储库

时间:2017-11-02 10:46:44

标签: git github version-control bitbucket vps

需要git-guru的帮助)))

现状如下:

  • 我在本地创建了我的项目,将所有内容都推送到了github。
  • 我从github git clone项目到VPS
  • 随着时间的推移,出现了从github迁移到bitbucket(财务问题)的需要
  • 现在当我从bitbucket中取出更改时,我必须git pull bitbucket [branch_name]

问题:

目前我想从github删除我的原始存储库,我有两个问题:

  • 是否会破坏我的VPS中的任何内容。我的意思是github是我的 原始回购,所以它不会是任何燃烧问题吗?

  • 如何将我的bitbucket repo设为默认设置,以便我不这样做 必须输入:

    git pull bitbucket [branch_name]

    但只需输入:

    git pull [branch_name]

1 个答案:

答案 0 :(得分:1)

您想要将git remote -v更改为指向您的bitbucket网址,然后移除您的bitbucket遥控器。您必须在VPS和本地执行此操作。它不应该破坏你的VPS中的任何东西。

如果您执行origin git@github.com:USERNAME/REPOSITORY.git (fetch) origin git@github.com:USERNAME/REPOSITORY.git (push) bitbucket git@bitbucket.org:USERNAME/REPOSITORY.git(fetch) bitbucket git@bitbucket.org:USERNAME/REPOSITORY.git (push) ,您会看到指向github的来源

git remote set-url origin git@bitbucket.org:USERNAME/REPOSITORY.git

要更改它,只需使用:

git remote -v

再次运行origin git@bitbucket.org:USERNAME/REPOSITORY.git(fetch) origin git@bitbucket.org:USERNAME/REPOSITORY.git (push) bitbucket git@bitbucket.org:USERNAME/REPOSITORY.git(fetch) bitbucket git@bitbucket.org:USERNAME/REPOSITORY.git (push) 验证更改

git remote rm bitbucket

删除你的bitbucket遥控器

git remote -v

然后再次运行origin,您应该只看到origin git@bitbucket.org:USERNAME/REPOSITORY.git(fetch) origin git@bitbucket.org:USERNAME/REPOSITORY.git (push)

{{1}}
相关问题