question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to checkout remote repo using secrets.GITHUB_TOKEN

See original GitHub issue

Not able to check out another private repo using secrets.GITHUB_TOKEN. Below the scenario, check out 1, and 2 works. 3 fails. Is there a limitation for secrets.GITHUB_TOKEN on remote repos?

repo-1 from for which GitHub action is running and repo-2 that it’s trying to checkout is in the same org

jobs:  
  test:
      name: test
      runs-on: self-hosted
      container: node:14-bullseye
      steps:
      - name: Checkout 1
        uses: actions/checkout@v3
        with:
          fetch-depth: 0      
          
      - name: Checkout 2
        uses: actions/checkout@v3
        with:   
            token: ${{ secrets.MY_PAT }}  
            repository: repo-2
            ref: 'main'     
            path: 'path-1'    
            
      - name: Checkout 3
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }} 
          repository: repo-2
          ref: "master"
          path: "path-2"

Error: Fetching the repository /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/master*:refs/remotes/origin/master* +refs/tags/master*:refs/tags/master* remote: Repository not found. Error: fatal: repository ‘https://github.com/xxxxxx/’ not found The process ‘/usr/bin/git’ failed with exit code 128 Waiting 11 seconds before trying again

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
igor-imaginemagecommented, Sep 13, 2022

I was facing this same issue and I was able to use a secret only if the secret name is GH_PAT, like this:

token: ${{ secrets.GH_PAT }}

0reactions
christianfrstormcommented, Oct 11, 2022

– All the best Christian Fr stormyhr Wednesday, 05 October 2022, 07:29am +02:00 from Dennis Gentry @.*** :

Yeah, I was never able to get GITHUB_TOKEN to work. My thought was that our tokens need to be blessed by our organization’s SSO or whatever it is, and that can’t ever happen with a GITHUB_TOKEN because it’s a one-time thing that is formed at the start of the action and goes away when it ends. But there’s no GitHub Enterprise documentation about it, so who knows? I’m really not seeing the benefit of this action over a simple shell script. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread. Message ID: @ github . com>

Read more comments on GitHub >

github_iconTop Results From Across the Web

remote: Repository not found in GitHub pipeline - Stack Overflow
Did you create the Personal Access Token and add it as a repository secret? This error occurs generally when the secret is empty....
Read more >
The GITHUB_TOKEN in GitHub Actions: How it Works ...
Just go to your repository or organization Settings, then click on Actions. Permissions UI. In here you can change the permissions assigned to ......
Read more >
GitHub Actions Security Best Practices [cheat sheet included]
Therefore the provided GITHUB_TOKEN will not have write access and the secrets are not accessible either. While these are sane defaults, in some ......
Read more >
The ultimate guide to GitHub Actions authentication
If you want to make a change in another repository when a PR is merged, this is not possible with the default GITHUB_TOKEN...
Read more >
GitHub Actions: Control permissions for GITHUB_TOKEN
The GITHUB_TOKEN is an automatically generated secret that lets you make ... permissions for the token in your organization or repository.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found