Error fetching branch from github (but it used to work)

On March 16th, my site deployed fine[1] after pushing to my repo on Github[2]
Since that time, all deploys have been failing[3]. I even tried to redeploy the same commit that worked on March 16th[4]. The error each time is “Error fetching branch: https://x-access-token:v1.[hash]@github.com/thunderrabbit/barefoot_rob refs/heads/master”

I guess I may have removed the SSH key from Github or something. Would that cause this error? If so, can you send me a new SSH key and a link explaining how to use the key?

best

  • Rob

[1] Netlify App
[2] GitHub - thunderrabbit/barefoot_rob: Barefoot Rob site for robnugen.com
[3] Netlify App
[4] Netlify App

Have you tried re-linking your Netlify build with your GitHub repository?

HI Greg

Thank you for the idea. I followed the instructions at Repo permissions & linking # Convert existing sites but the deploy still fails[1] with the same error as before.

[1] Netlify App

I don’t understand everything I know about this, but the failure currently is at a point where previously there was success (duh!). If you did not make a change to your files, did you make a change to your deploy settings? I’m out of ideas here. Sorry.

Thank you for your ideas, Greg… My best guess is that an ssh key got deleted from GIthub. I know I removed some old keys from Github, but I don’t think I removed any for my Netlify site. I did not carefully document my setup and do not recall which keys should be where.

Hi, @thunderrabbit.

There was an original issue where (I think) some change had been made it the Git repo where the cached version of the repo in the build cache was in a state where updating the repo was failing:

5:56:06 PM: Starting to prepare the repo for build
5:56:06 PM: Preparing Git Reference refs/heads/master
5:56:10 PM: Error fetching branch: https://x-access-token:v1.<redacted>@github.com/thunderrabbit/barefoot_rob refs/heads/master
5:56:10 PM: Failing build: Failed to prepare repo
5:56:10 PM: failed during stage 'preparing repo': exit status 1
5:56:10 PM: Finished processing build request in 13.965550458s

The usual solution for that is to build while clearing the build cache to get a fresh clone of the repo. Here is a screenshot of that setting in the UI:

I actually tried this for that site already. This new deploy attempt is now showing errors for the submodule SSH keys not working:

This is almost certainly because the repo was re-linked. Re-linking does reset the SSH key used. This is the new public key to add at GitHub for this site:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDLl5vhOQrUCLoK/Z6o2akTFkzixEvJYs2S2/66jB+VCjglL+8q+6S77b1ynY2h1h3p16Wm+elzmgDMgzqRx8xaxkqwJCWhUXT3w/MGuMQBWaglXRQmE24bHDh2U4EahMv8/LjIpJUnEv5Wxmx5YGuRAS6jQEIpzQPjeZrrSGZpz9/7SHYjnMlz2LVgswfcZ0jAQ6dcRPsXIgAlrFP4RBv/GdeyJE+meY8DfsMgST7FNgdl0/XrYkuZAr6/x34eYuD/RD6LLl3ufmUxiqg+eNoH4Ngd5kvXcHduNDGjCF6edTk0gNTY5FyB5NFQi06sy3FsX1G3u55FSCI6jM6h1ZE4gmCKJUPKQVzj/ZKuAsVWo3CaWBAod0vsD+tDS0lLZbkR5BlORq9zNURp1SDLkgRJs46+UibaZXsx3yF+/MDcLto1fHRIHkMIlixtu7F1On4LWUQfcoOeAcvXhZByj8dCm+EDU586EoNXYnQ2ifUekjfqJqm6YwTtiQv61kltVd6A4Vq7MS/jd2l46CP/lBToVK015MFtlVZ0rP8S1rr6Sq2h6U8Wd3nAtSorow8MpSVlCyE4tPYwPQzxxLSq6dPPnoLpNFGOHUJGBAcK7RhMPI691Ob0XZBsDbQ0I7gv6Db4PiEgAUwUPFK2C6PnQHHm3Ae4r2i1pX4LL4h7Z+OxYQ==

You can use this key with multiple private submodules attached to the same repository, but that does take some extra work since GitHub does not allow Deploy Keys to be used in multiple places. You’ll have to instead add them to a user (perhaps you? or maybe a robot-account that you create on GitHub) that has access to all repos.

If there are other questions about this, we’ll be happy to answer.

1 Like

That is so funny that all I had to do was clear cache and try again.

I will remember that relinking the repo recreates the ssh key, and definitely remember the Clear Cache quick fix!

Thank you so much.

1 Like