checkout icon indicating copy to clipboard operation
checkout copied to clipboard

Error: fatal: repository not found (private repo)

Open bitsofinfo opened this issue 4 years ago • 12 comments

Anyone else getting this? This just started yesterday evening and still getting it. The repository does exist and this flow used to work fine earlier in the day.

...
      - name: "Checkout"
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - run: |
          git checkout ${{ github.event.inputs.ref }}

...
 Error: fatal: repository 'https://github.com/bitsofinfo/my-private-repo/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 12 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*

bitsofinfo avatar Feb 19 '21 12:02 bitsofinfo

i get it randomly now on windows, please fix it

Update: Ok. It turns out I couldn't use github_token to checkout submodules, i have to create an access_token

chenghuang-mdsol avatar Feb 23 '21 03:02 chenghuang-mdsol

the only way I could get it to work again is to go into your settings on your repo and REVOKE all access to it for github actions, save.... then re-grant access for github actions. For whatever reason, next time I ran it, it has its access back.

bitsofinfo avatar Feb 26 '21 14:02 bitsofinfo

any solutions for this? we started getting this error randomly today a few hours ago.

ulabs-spotbhare avatar May 17 '21 06:05 ulabs-spotbhare

@ulabs-spotbhare try my last comment, other than that I couldn't figure it out either

bitsofinfo avatar May 17 '21 13:05 bitsofinfo

Same here

jaredmdobson avatar May 27 '21 01:05 jaredmdobson

same, this has just started happening to one of our private repos.

the workaround mentioned here seems to be working for now i very much dont want to update all our repos.

alex-mozejko avatar Jun 01 '21 03:06 alex-mozejko

had same issue.... what I did to fix it

Go to manage access in settings and make sure you have the right access to push to the repo In command line, run - git remote set-url origin git://new.url.here Set you branch and push again

I noticed once the origin is removed and added again, it fixes the error hopefully this helps

prosper74 avatar Dec 12 '21 10:12 prosper74

Man, this could be more pleasant. I am using many private repositories, some behaving like this. No difference between them. GitHub, could you guys fix it?

Run actions/checkout@v3
  with:
    repository: <ORG/REPO>
    ref: main
    fetch-depth: 1
    path: release
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    lfs: false
    submodules: false
    set-safe-directory: true
  env:
    IMAGE_TAG: v1.0.4052747071.rev
Syncing repository: <ORG/REPO>
Getting Git version info
  Working directory is '/runner/_work/<ORG/REPO>/<ORG/REPO>/release'
  /usr/bin/git version
  git version 2.39.1
Temporarily overriding HOME='/runner/_work/_temp/695daa72-e30a-4b00-8e51-46d089e99f1c' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /runner/_work/<ORG/REPO>/<ORG/REPO>/release
Initializing the repository
  /usr/bin/git init /runner/_work/<ORG/REPO>/<ORG/REPO>/release
  Initialized empty Git repository in /runner/_work/<ORG/REPO>/<ORG/REPO>/release/.git/
  hint: Using 'master' as the name for the initial branch. This default branch name
  hint: is subject to change. To configure the initial branch name to use in all
  hint: of your new repositories, which will suppress this warning, call:
  hint: 
  hint: 	git config --global init.defaultBranch <name>
  hint: 
  hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
  hint: 'development'. The just-created branch can be renamed via this command:
  hint: 
  hint: 	git branch -m <name>
  /usr/bin/git remote add origin https://github.com/<ORG/REPO>
Disabling automatic garbage collection
  /usr/bin/git config --local gc.auto 0
Setting up auth
  /usr/bin/git config --local --name-only --get-regexp core\.sshCommand
  /usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
  /usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
  /usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
  /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/main*:refs/remotes/origin/main* +refs/tags/main*:refs/tags/main*
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/<ORG/REPO>/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 17 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/main*:refs/remotes/origin/main* +refs/tags/main*:refs/tags/main*
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/<ORG/REPO>/' not found
  The process '/usr/bin/git' failed with exit code 128
  Waiting 20 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/main*:refs/remotes/origin/main* +refs/tags/main*:refs/tags/main*
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/<ORG/REPO>/' not found
  Error: The process '/usr/bin/git' failed with exit code 128

karmops avatar Jan 31 '23 09:01 karmops

Do you guys use permissions in your .yaml-file?

If so, try to add permissions for checkout, because apparently adding a permission in one section revokes other perms of the "parent" section.

amedveshchek avatar Feb 12 '23 11:02 amedveshchek

@amedveshchek oh my... I had temporarily commented that out, and now was debugging for 30 minutes why it wasn't working hehe.. Works with permissions and checkout v3

dejoma avatar Feb 14 '23 17:02 dejoma

@amedveshchek oh my... I had temporarily commented that out, and now was debugging for 30 minutes why it wasn't working hehe.. Works with permissions and checkout v3

Where are you putting the permissions key exactly?

awhisler avatar Dec 12 '23 19:12 awhisler

It seems that despite it's stated in github docs that the github_token always has contents at least with read access, it's wrong. For private repos (organization-owned for me, but it might differ for personal accounts) it seems that the token has none access for contents.

Moreover, if you specify something like this:

name: "test workflow"

permissions:
  contents: read #doing it explicitly

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write # for other steps in this workflow

    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          token: ${{ github.token }}

it won't work, as permissions on jobs level negates contents: read and defaults it back to none.

Haarolean avatar Feb 21 '24 20:02 Haarolean