Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug git remote set-url not working

Tags:

git

github

I'm unable to change git remote url from git:// to https://.

As illustrated below, git remote set-url isn't working:

$ git remote -v

origin git://github.com/userName/repoName.git (fetch)

origin git://github.com/userName/repoName.git (push)

$ git remote set-url origin https://github.com/userName/repoName.git

$ git remote -v

origin git://github.com/userName/repoName.git (fetch)

origin git://github.com/userName/repoName.git (push)

I have also tried removing the remote and re-adding it, to no avail.

.git/config

[remote "origin"]
    url = https://github.com/userName/repoName.git
    fetch = +refs/heads/*:refs/remotes/origin/*

I have checked many of the plethora of queries concerning git remote set-url, but none dealing with this issue of set-url not working.


2 Answers

SOLVED

From running $ git config --list I realized that .git/config was forcing git to rename all remotes. See here for more information.

To resolve the issue, you can either:

  1. Manually edit the file: git config --global --edit
  2. Remove section: git config --global --remove-section url."git://github.com/"

The second option is preferable as it is safer than directly editing git config file.

Use command (You maybe must using Administration permission on Windows operating system, or sudo permission on macOS or Linux)

git remote add upstream https://example.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

See https://help.github.com/articles/configuring-a-remote-for-a-fork/

like image 45
Do Nhu Vy Avatar answered Sep 19 '25 20:09

Do Nhu Vy