【问题标题】:How to change git remote origin git:// to https://? [duplicate]如何将 git remote origin git:// 更改为 https://? [复制]
【发布时间】:2018-10-05 19:18:52
【问题描述】:

我在 git Bash 中写了这个

git remote -v 
origin  git://github.com/devRena/test (fetch) 
origin  git://github.com/devRena/test (push)

当我说

git push origin master 
fatal remote error: 
You can't push to git://github.com/devRena/test.git   
Use https://github.com/devRena/test.git

如何将 git://github.com/devRena/test.git 改成https://github.com/devRena/test.git ??

【问题讨论】:

  • git remote set-url origin https://github.com/devRena/test.git。要仅更改推送 url,请添加选项 --push。顺便说一句,git push https://github.com/devRena/test.git master 也可以使用一次。
  • 我做了但没有改变,我有同样的错误
  • git push github.com/devRena/test.git master fatal: remote error: You can't push to git://github.com/devRena/test.git 使用github.com/devRena/test.git
  • 运行git config -l查看是否有url.xxx.pushinsteadofurl.xxx.insteadof
  • 所以它是由url.git://.insteadof=https://引起的。通过删除或评论从 gitconfig 禁用它。

标签: git github


【解决方案1】:

您可以简单地手动编辑 .git/config 文件。

找到开头的部分:

[remote "origin"]

替换:

url = https://github.com/USERNAME/REPOSITORY.git

url https://github.com/devRena/test.git

保存

【讨论】:

    【解决方案2】:

    查看来自 GitHub 的 Changing a remote's URL 文档:

    使用git remote set-url 命令更改遥控器的 URL:

    git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
    

    在你的情况下,试试这个:

    git remote set-url origin https://github.com/devRena/test.git 
    

    【讨论】:

      猜你喜欢
      • 2015-01-20
      • 2014-03-05
      • 2020-10-08
      • 2011-02-10
      • 2015-10-03
      • 1970-01-01
      • 2020-04-12
      • 2023-02-26
      • 2017-11-13
      相关资源
      最近更新 更多