How to unset git config?

After encountering authentication issues with pushing from Github Desktop, I followed some advice here, and ended up making some changes to my git config that I now cannot figure out how to undo.
When I enter in “git config --global --edit” in Terminal, the popup window contains these lines, which are the ones I’d like to get rid of but can’t:

[url "git@github.com:"]
        insteadOf = https://github.com/
[url "https:github.com/"]
        insteadOf = git@github.com:
[url "git://"]
        insteadOf = https://

Could anyone help with this?

What do you mean by “can’t”? Deleting the relevant parts of the git config should work to get rid of settings. Alternatively you could look at git config --unset.

1 Like

Hi airtower-luna, thanks for your reply! By “can’t” I mean that when I hit delete on any of the letters, it just moves my typing position back like a left-arrow, without erasing any actual characters. I can replace characters by typing letters, but not delete them.

However, I took another look at your unset rec and figured out how to undo my git config mistakes!
For anyone who’s running into similar issues, I ended up inputting the following code in Terminal:

git config --global --unset-all url.git@github.com:.insteadof
git config --global --unset-all url.https:github.com/.insteadof
git config --global --unset-all url.git://.insteadof

So yeah, still not sure why I couldn’t delete characters in “git config --global --edit” directly, but at least I managed to unset them outside. Thanks again!

1 Like

Is the editor that was started with the --edit option by any chance Vi? That one is known for its obscure keyboard commands, but you can find guides online. :sweat_smile:

Nah, it’s just Terminal, weirdly. Deleting has worked everywhere else in Terminal except for in that “git config --global --edit” window :confused:

Vi would usually run in the terminal (though GUI versions exist). It’s a very common default editor on Unix-ish systems, and if you’re using Windows I wouldn’t be surprised at all if Git Bash used it, too.

Ohh that would make sense then! I’m using mac but I just looked it up online and Vi seems to come preinstalled on most macOS.

1 Like