Today I encountered an issue with GitHub where I was unable to fetch a remote repository to merge into my local clone. Everything seemed to be configured correctly, and I am able to fetch repositories from the same user without a problem, so it seems like there is some issue with this particular repository. Although I have a support ticket open with GitHub to try and determine the root cause of the issue, for now I do have a workaround which I figured I’d share in case it helps anyone out there. The solution essentially is to add the remote repository over the https, rather than git protocol, as described below.

The Problem

I have a local clone of a repository I forked on GitHub, following the Fork a Repository instructions found on GitHub. This has always worked fine for me, up until today, with this particular repository. Attempting to fetch changes from the remote repository was failing like so:


$ git fetch upstream



fatal: remote error:

  Repository not found.

Same error for a git remote show as well:


$ git remote show upstream



fatal: remote error:

  Repository not found.

Adding the verbose flag added no additional information.

The Workaround

I won’t quite call it a ‘solution’, but my workaround came from Googling around and learning that a remote repository can be added over a number of protocols. So I removed the remote that I had added with the git protocol per the Fork a Repository instructions, and re-added it over the https protocol:


$ git remote rm upstream

$ git remote add upstream https://github.com/octocat/Spoon-Knife.git

$ git fetch upstream

Username:

Password:

$ git merge upstream/master

Note the remote url protocol https://github.com/octocat/Spoon-Knife.git rather than git://github.com/octocat/Spoon-Knife.git. Over the HTTPS protocol everything works as expected, I just have to provide my GitHub username/password, which I did not have to do when the git protocol was working. If I hear back from GitHub support I’ll update this article with any further information.

Update: Resolution from GitHub

I suppose one pertinent piece of information I neglected to mention in this post, is that the repository in question is a private, rather than public repository. A member from the GitHub support staff responded to me with the following:

That repo is private, ‘git://’ URLs don’t work with private repos. Try the ‘https://’ clone URL instead.

So, there you have it, I guess it was actually a feature after all.

Published by Justin Stern

Justin is one of our co-founders, and is our resident overengineer. He likes to write developer tutorials and make black magic happen in our plugins. He thinks that writing code is a lot easier than writing words.

3 Comments

  1. Thanks! That is exactly what I need. Had the same problem with private repository.

  2. Encountered the issue as well, thanks Justin.

  3. There is an easy way to do it :

    git remote set-url origin https://github.com/octocat/Spoon-Knife.git

Comments are closed.

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match