Github’s “repository not found” error and How to fix it

GitHub is an excellent platform for managing code repositories and collaborating with other developers. One of the great features of GitHub is Github Action, which automates your workflow for private and public repositories. However, recently, I noticed that GitHub Action is throwing an error while using GITHUB_TOKEN in the private repo. This issue is not occurring for the private repos under the Enterprise Plan. In my case, it was the private repo under the Free Plan. The error looks like below:


Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 18 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 11 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a6f81a034bf482d652ccb6d1609f1a25d8ec947b:refs/remotes/pull/5/merge
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/eftakhairul/helloworld/' not found
  Error: The process '/usr/bin/git' failed with exit code 128

Why?

I found an issue reported on May 22, 3020. The issue is probably due to the default token: GITHUB_TOKEN doesn’t have permission to checkout the private repo. It doesn’t work even if you setup the permissions to GITHUB_TOKEN to access other private repo. Right now, the issue is closed. Multiple users reported that they were having the same issues. Today I got the same error.

Solutions

I don’t know whether the Github will fix it or not.  However, there is a work around to bypass the issue. I will explain that one now.

Steps:

1. Generate your own Persona access token with the proper permissions. Go to: settings > Developer settings under your account & create Personal access tokens.  Click on Tokens (classic)


With the following permissions

2. Add the token to the repo’s Secrets. Go to: Repo’s Settings >  Secrets and variables > Actions

3. Update your Action’s workflow steps


- uses: actions/checkout@v2
  with:
    token: ${{ secrets.YOUR_CUSTOM_GITHUB_TOKEN }}

Re-run your Github’s workflow again. It will work. Happy Hacking 🙂

 

Eftakhairul Islam

Hi, I'm Eftakhairul Islam, a passionate Software Engineer, Hacker and Open Source Enthusiast. I enjoy writing about technical things, work in a couple of startup as a technical advisor and in my spare time, I contribute a lot of open source projects.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Read previous post:
Inspect HTTP Request and Response in Golang

Golang is getting popular for writing a web applications. One of the core concepts of this web application is handling...

Close