Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何调试git远程设置url不工作_Git_Github - Fatal编程技术网

如何调试git远程设置url不工作

如何调试git远程设置url不工作,git,github,Git,Github,我无法将git远程url从git://更改为https:// 如下图所示,git远程设置url不起作用: $git remote-v 起源git://github.com/userName/repoName.git (取回) 起源git://github.com/userName/repoName.git (推) $git远程设置url源https://github.com/userName/repoName.git $git remote-v 起源git://github.com/userNa

我无法将git远程url从
git://
更改为
https://

如下图所示,
git远程设置url
不起作用:

$git remote-v

起源git://github.com/userName/repoName.git (取回)

起源git://github.com/userName/repoName.git (推)

$git远程设置url源https://github.com/userName/repoName.git

$git remote-v

起源git://github.com/userName/repoName.git (取回)

起源git://github.com/userName/repoName.git (推)

我也尝试过移除遥控器并重新添加,但没有效果

.git/config

[remote "origin"]
    url = https://github.com/userName/repoName.git
    fetch = +refs/heads/*:refs/remotes/origin/*
我已经检查了很多关于
git远程设置url
的查询,但是没有一个涉及
set url
不工作的问题。

解决了 通过运行
$git config--list
我意识到.git/config迫使git重命名所有远程设备

要解决此问题,您可以:

  • 手动编辑文件:
    git config--global--edit
  • 删除节:
    git config--global--Remove节url。“git://github.com/“
  • 第二个选项更可取,因为它比直接编辑git config文件更安全。

    使用命令(您可能必须在Windows操作系统上使用管理权限,或者在macOS或Linux上使用sudo权限)


    非常感谢!我花了一段时间才意识到我的原始获取设置为repo.git,而不是实际的repo名称。这是因为我有一个全局配置以某种方式保存到repo.git,它阻止我使用设置的url进行更改。
    git remote add upstream https://example.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git