Sin Han Jinn
Sin Han Jinn

Reputation: 684

Git - How to remove remote by URL

I've tried searching for how to remove remote by URL but all suggestions is to remove entire remote and re-add required URLs.

Initially, I've added the url using command,

git remote set-url --add --push all C:\Users\UserName\Desktop\TestPath

Then, amongst all the available urls in the config file, how do I remove just this particular URL line? (highlighted yellow) config file

I did try the following command git remote set-url --delete all C:\Users\UserName\Desktop\TestPath But I received this error -> could not unset 'remote.all.url'

I've also checked for available paths using git config --list --show-origin just to reconfirm the value is only coming from this one specific file.

Any ideas would be greatly appreciated!

Thanks.

Upvotes: 1

Views: 284

Answers (1)

kosist
kosist

Reputation: 3067

You need to use --push parameter, and also use two slashes in the url path (so it will be written in the same way as in configuration file).

git remote set-url --delete --push all C:\\Users\\UserName\\Desktop\\TestPath

--push parameter will indicate that push URLs are manipulated instead of fetch URLs (git remote documentation)

Upvotes: 1

Related Questions