Git Remote Add Upstream - fatal: remote upstream already exists
While attempting to add https://github.com/alanrenouf/vCheck-vSphere as an upstream something went awry and I was constantly presented with the error:
fatal: remote upstream already exists
OK, but when I tried to fetch the upstream it failed with:
fatal: ‘upstream’ does not appear to be a git repository
Being new to git this took a little while to figure out, but I thought I’d document it in case it would be helpful for someone else.
Inside a repository you can check your remote repositories configured with:
[plain]
git remote -v
[/plain]
From which I could see that my fork was correctly configured with a URL, but not the upstream
This can be corrected with:
[plain]
git remote set-url upstream https://github.com/alanrenouf/vCheck-vSphere.git
[/plain]
and confirmed with again:
[plain]
git remote -v
[/plain]
Subsequently, I was able to fetch the upstream:
[plain]
git fetch upstream
[/plain]