【问题标题】:How to change git repository using cloud 9如何使用云 9 更改 git 存储库
【发布时间】:2017-11-28 17:24:43
【问题描述】:

我使用命令克隆了一个 github 存储库

git config --global user.name "x"
git config --global user.email x
git init
git add -A
git commit -m "message"
git remote add origin /link/
git push -u origin master

现在我在工作区中,想要将工作区连接到不同的 GitHub 存储库。该怎么做?

感谢您的宝贵时间

【问题讨论】:

  • 您可以添加更多的远程或更改默认的origin 远程以指向不同的远程,但您通常不希望将您的存储库更改为转到一个不相关的 远程存储库。如果您想处理完全不同的代码集,请创建一个新文件夹和 cloneinit(仅供参考,您所做的不是 clone)。

标签: git github cloud9-ide cloud9


【解决方案1】:

如果你已经连接到 github reop

,你需要先移除一个远程

移除遥控器 使用 git remote rm 命令从存储库中删除远程 URL。

git remote rm 命令有一个参数: 远程名称,例如目的地:

$git remote -v
# View current remotes
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)
destination  https://github.com/FORKER/REPOSITORY.git (fetch)
destination  https://github.com/FORKER/REPOSITORY.git (push)
$git remote rm destination
# Remove remote
$git remote -v
# Verify it's gone
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)

注意:git remote rm 不会从服务器上删除远程仓库。它只是从本地存储库中删除远程及其引用。

其次,我 git init 新仓库。

希望对你有帮助

【讨论】:

    猜你喜欢
    • 2020-07-13
    • 2015-08-15
    • 2021-05-02
    • 2012-09-03
    • 1970-01-01
    • 2018-06-06
    • 1970-01-01
    • 2012-10-19
    • 2022-07-14
    相关资源
    最近更新 更多