actions / checkout

Action for checking out a repo
https://github.com/features/actions
MIT License
5.74k stars 1.7k forks source link

Error: fatal: repository not found (private repo) #445

Open bitsofinfo opened 3 years ago

bitsofinfo commented 3 years ago

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/*
chenghuang-mdsol commented 3 years ago

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

bitsofinfo commented 3 years ago

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.

ulabs-spotbhare commented 3 years ago

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

bitsofinfo commented 3 years ago

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

jaredmdobson commented 3 years ago

Same here

alex-mozejko commented 3 years ago

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.

prosper74 commented 2 years ago

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

karmops commented 1 year ago

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
amedveshchek commented 1 year ago

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.

dejoma commented 1 year ago

@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

awhisler commented 9 months ago

@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?

Haarolean commented 7 months ago

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.