【问题标题】:How to remove the git remote origin and add new remote origin?如何删除 git 远程源并添加新的远程源?
【发布时间】:2020-02-07 12:16:48
【问题描述】:

我已经从另一个人的 git repo 克隆了代码,现在我想将代码提交到我的 git repo。如果不单独复制粘贴结帐后如何做到这一点?

任何 git 参考都会更有帮助。

【问题讨论】:

  • 您可以直接修改“.git”文件夹中的配置文件。该文件夹已隐藏,您可以通过窗口资源管理器显示它。

标签: git github git-remote


【解决方案1】:

依次运行以下命令:

  • git remote

将获取当前远程路径

  • git remote remove <remote path>

所以现在你的远程链接将被删除,现在你可以添加你的 repo 并提交你的更改,无论如何使用以下命令确认远程是否已被删除

  • git remote

什么都不应该显示

  • git remote add origin <your git repo http path>

现在您的 repo 将作为 git repo 添加到此文件夹,因此现在使用以下命令将您的代码更改推送到新 repo。

  • git push origin master

【讨论】:

  • git remove remote google git: 'remove' is not a git command. See 'git --help'.
  • 应该是git remote remove <remote name>
猜你喜欢
  • 1970-01-01
  • 2017-08-15
  • 2011-06-20
  • 2018-03-19
  • 1970-01-01
  • 2012-11-14
相关资源
最近更新 更多