I accidentally reversed the order of some arguments when trying to add an upstream remote to my git repo.
I.e., I input
git remote add https://github.com/jupyter/nbconvert.git upstream
Which led to
fatal: 'https://github.com/jupyter/nbconvert.git' is not a valid remote name
But now,
git remote add upstream https://github.com/jupyter/nbconvert.git
returns:
fatal: remote upstream already exists.
and
git remote rm upstream
returns:
error: Could not remove config section 'remote.upstream'
Then,
git remote -v
I get
origin [email protected]:michaelpacer/nbconvert.git (fetch)
origin [email protected]:michaelpacer/nbconvert.git (push)
upstream
And when I look in my .git/config
there is no instance of [remote "upstream"]
…
So I'm a little stumped.
I'm not sure precisely how this happened, but I believe the problem is that you have a non-empty [remote "upstream"]
section in your --global
config (usually $HOME/.gitconfig
but git config --global --edit
will bring up the correct file in your editor). I verified that once in this state, git remote rm upstream
acts the way you are seeing.
If you clean that out, the normal method of adding a remote named upstream
should begin working again. You can use your editor to clean it out, or use:
git config --global --remove-section remote.upstream