Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: could not unset 'remote.origin.url'

Tags:

git

I've observed that my Git repository has two remotes for origin because when I run this:

git config --get-regexp 'remote\\.origin\\..*'

I get two results:

remote.origin.url https://user:password@my-repo:7990
remote.origin.url http://my-repo.com:7990/scm/my-project.git

However, I fail to delete either of them. For instance, if I try to delete the first one, like this:

git remote set-url --delete origin https://user:password@my-repo:7990

I get:

fatal: could not unset 'remote.origin.url'

Any idea why this error appears?

like image 966
octavian Avatar asked Mar 23 '17 16:03

octavian


People also ask

How do I remove a git remote URL?

The git remote remove command removes a remote from a local repository. You can use the shorter git remote rm command too. The syntax for this command is: git remote rm <remote-url>. If you remove a remote accidentally, you will need to add it back manually using the git remote add command.

How do I find my remote origin URL?

You can view that origin with the command git remote -v, which will list the URL of the remote repo.


1 Answers

You can remove the remote origin then add again.

$ git remote rm origin                   # remove a first remote
$ git remote -v

# if you see your second origin
$ git remote rm origin                   # remove the second origin

$ git remote add origin <repo-url>       # add new origin

$ git remote -v                          # see all the remotes you have  
like image 157
Sajib Khan Avatar answered Sep 28 '22 10:09

Sajib Khan