[GH-ISSUE #233] Git checkout requires github token #162

Closed
opened 2026-03-01 21:40:45 +03:00 by kerem · 16 comments
Owner

Originally created by @ovitente on GitHub (May 13, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/233

Hello

OS: MacOS Catalina
GIT: 2.26.2 (installed through brew and added /usr/local/bin/ to $PATH)

My workflow has this step

    - uses: actions/checkout@v2
      name: GIT | Checkout
      with:
        ref: ${{ github.ref }} 

As result with act can't continue due this error that i can't handle, because there are no info in --help about it.

[STAGE | DEPLOY/CI | api | DEPLOY]   ?  ::group::Getting Git version info
| Working directory is '/github/workspace'
[STAGE | DEPLOY/CI | api | DEPLOY]   ? ::endgroup::
| Deleting the contents of '/github/workspace'
| The repository will be downloaded using the GitHub REST API
| To create a local Git repository instead, add Git 2.18 or higher to the PATH
| Downloading the archive
| Parameter token or opts.auth is required
| Waiting 11 seconds before trying again
| Downloading the archive
| Parameter token or opts.auth is required
| Waiting 17 seconds before trying again
Error: context canceled

Questions:

  • Why act is trying to get reach into remote private repo instead of using local fresh pulled copy?
  • What should i put into opts.auth file and where to put it to get act working?
Originally created by @ovitente on GitHub (May 13, 2020). Original GitHub issue: https://github.com/nektos/act/issues/233 Hello **OS:** MacOS Catalina **GIT:** 2.26.2 (installed through brew and added `/usr/local/bin/` to `$PATH`) My workflow has this step ``` - uses: actions/checkout@v2 name: GIT | Checkout with: ref: ${{ github.ref }} ``` As result with `act` can't continue due this error that i can't handle, because there are no info in `--help` about it. ```| Syncing repository: <repo-owner>/<myrepo> [STAGE | DEPLOY/CI | api | DEPLOY] ? ::group::Getting Git version info | Working directory is '/github/workspace' [STAGE | DEPLOY/CI | api | DEPLOY] ? ::endgroup:: | Deleting the contents of '/github/workspace' | The repository will be downloaded using the GitHub REST API | To create a local Git repository instead, add Git 2.18 or higher to the PATH | Downloading the archive | Parameter token or opts.auth is required | Waiting 11 seconds before trying again | Downloading the archive | Parameter token or opts.auth is required | Waiting 17 seconds before trying again Error: context canceled ``` --- **Questions:** * Why `act` is trying to get reach into remote private repo instead of using local fresh pulled copy? * What should i put into `opts.auth` file and where to put it to get `act` working?
kerem 2026-03-01 21:40:45 +03:00
Author
Owner

@gimmyxd commented on GitHub (May 13, 2020):

What should i put into opts.auth file and where to put it to get act working?

@ovitente i got past a similar issue by using GITHUB_TOKEN=my_token act command

<!-- gh-comment-id:627997091 --> @gimmyxd commented on GitHub (May 13, 2020): > What should i put into opts.auth file and where to put it to get act working? @ovitente i got past a similar issue by using `GITHUB_TOKEN=my_token act command`
Author
Owner

@ovitente commented on GitHub (May 14, 2020):

@gimmyxd Unfortunately I am receiving the same error.
GITHUB_TOKEN=my_token act
or

export GITHUB_TOKEN=my_token
act

Not working :(

image

<!-- gh-comment-id:628799589 --> @ovitente commented on GitHub (May 14, 2020): @gimmyxd Unfortunately I am receiving the same error. `GITHUB_TOKEN=my_token act` or ``` export GITHUB_TOKEN=my_token act ``` Not working :( ![image](https://user-images.githubusercontent.com/10868371/81969465-b3577b80-9626-11ea-9c7a-1420a388f12b.png)
Author
Owner

@Magnum97 commented on GitHub (Jun 5, 2020):

I found that if one goes to Settings and Personal Access Tokens, and generate a new token. Make sure to remove all access except user and use this key in place of ${ secrets.GITHUB_TOKEN ) it solved my issue with this exact error.

Edit:
Felt negligent not to mention that you should not commit this to your repository. I created a local branch to use it in for testing.

<!-- gh-comment-id:639348240 --> @Magnum97 commented on GitHub (Jun 5, 2020): I found that if one goes to Settings and [Personal Access Tokens](https://github.com/settings/tokens), and generate a new token. Make sure to *remove* **all** access **except** user and use this key in place of `${ secrets.GITHUB_TOKEN )` it solved my issue with this exact error. Edit: Felt negligent not to mention that you should not commit this to your repository. I created a local branch to use it in for testing.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 5, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:668895475 --> @github-actions[bot] commented on GitHub (Aug 5, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@1oglop1 commented on GitHub (Sep 27, 2020):

Thanks all above for the workaround, I just hit the same issue.

I could clone my own repo but when I tried to clone another public repo I've got an error. It may be have to do something with this: https://github.com/actions/checkout#checkout-multiple-repos-private
even though the bolt-python repo is public.

    - name: Checkout
      uses: actions/checkout@v2
      with:
        path: main
    - name: Checkout bolt-python repo
      uses: actions/checkout@v2
      with:
        repository: slackapi/bolt-python
        path: bolt-python

It would be good to mention this in README of act project or use GitHub token as a requirement by default.

<!-- gh-comment-id:699616228 --> @1oglop1 commented on GitHub (Sep 27, 2020): Thanks all above for the workaround, I just hit the same issue. I could clone my own repo but when I tried to clone another public repo I've got an error. It may be have to do something with this: https://github.com/actions/checkout#checkout-multiple-repos-private even though the bolt-python repo is public. ``` - name: Checkout uses: actions/checkout@v2 with: path: main - name: Checkout bolt-python repo uses: actions/checkout@v2 with: repository: slackapi/bolt-python path: bolt-python ``` It would be good to mention this in README of `act` project or use GitHub token as a requirement by default.
Author
Owner

@ovitente commented on GitHub (Oct 20, 2020):

Working solution for token on current version, - 0.2.16

cd your_local_repo_directory
export GITHUB_TOKEN=YOUR_TOKEN
act -w .github/workflow/dev.yaml
<!-- gh-comment-id:712775796 --> @ovitente commented on GitHub (Oct 20, 2020): Working solution for token on current version, - `0.2.16` ``` cd your_local_repo_directory export GITHUB_TOKEN=YOUR_TOKEN act -w .github/workflow/dev.yaml ```
Author
Owner

@yoanne2x commented on GitHub (May 7, 2021):

Hi, I would like to re-open this issue.

I have just installed act on my local mac, tried to run it against a private rep and I have the same issue as above:

[CI/Deployment] ::error::Input required and not supplied: token
[CI/Deployment] Failure - actions/checkout@v2

If I manually add the token in the action within the job with my personal generated token, it will work.

If I try to use the export GITHUB_TOKEN=<> and execute act, I get the same error.

is there something that I am missing?

kind regards

<!-- gh-comment-id:834288585 --> @yoanne2x commented on GitHub (May 7, 2021): Hi, I would like to re-open this issue. I have just installed act on my local mac, tried to run it against a private rep and I have the same issue as above: [CI/Deployment] ❗ ::error::Input required and not supplied: token [CI/Deployment] ❌ Failure - actions/checkout@v2 If I manually add the token in the action within the job with my personal generated token, it will work. If I try to use the export GITHUB_TOKEN=<<my token>> and execute act, I get the same error. is there something that I am missing? kind regards
Author
Owner

@catthehacker commented on GitHub (May 7, 2021):

You should pass GITHUB_TOKEN as secret, act -s GITHUB_TOKEN=[insert token or leave blank for secure input]

<!-- gh-comment-id:834302924 --> @catthehacker commented on GitHub (May 7, 2021): You should pass `GITHUB_TOKEN` as secret, `act -s GITHUB_TOKEN=[insert token or leave blank for secure input]`
Author
Owner

@torbjornvatn commented on GitHub (May 7, 2021):

You should pass GITHUB_TOKEN as secret, act -s GITHUB_TOKEN=[insert token or leave blank for secure input]

@catthehacker Maybe we should make this clear in the README, because there it's only mentioned as a something you need to use GHE

<!-- gh-comment-id:834321100 --> @torbjornvatn commented on GitHub (May 7, 2021): > You should pass `GITHUB_TOKEN` as secret, `act -s GITHUB_TOKEN=[insert token or leave blank for secure input]` @catthehacker Maybe we should make this clear in the README, because there it's only mentioned as a something you need to use GHE
Author
Owner

@YuMuuu commented on GitHub (May 28, 2021):

I encounted the same problem.
https://github.com/nektos/act/issues/233#issuecomment-834288585

Why need the gtihub token to run locally ??

<!-- gh-comment-id:850238708 --> @YuMuuu commented on GitHub (May 28, 2021): I encounted the same problem. https://github.com/nektos/act/issues/233#issuecomment-834288585 Why need the gtihub token to run locally ??
Author
Owner

@catthehacker commented on GitHub (May 28, 2021):

@YuMuuu please see #678

<!-- gh-comment-id:850244296 --> @catthehacker commented on GitHub (May 28, 2021): @YuMuuu please see #678
Author
Owner

@YuMuuu commented on GitHub (May 28, 2021):

@catthehacker Thanks for the information! I I understood it.

<!-- gh-comment-id:850258188 --> @YuMuuu commented on GitHub (May 28, 2021): @catthehacker Thanks for the information! I I understood it.
Author
Owner

@merlinstardust commented on GitHub (Jun 1, 2021):

Since the GITHUB_TOKEN is required, act should check if it's passed in and if it's not there, act should immediately alert the user to its necessity.

Also, the README does not mention that this is required

<!-- gh-comment-id:852364784 --> @merlinstardust commented on GitHub (Jun 1, 2021): Since the `GITHUB_TOKEN` is required, `act` should check if it's passed in and if it's not there, `act` should immediately alert the user to its necessity. Also, the README does not mention that this is required
Author
Owner

@catthehacker commented on GitHub (Jun 1, 2021):

@merlinpatt please see #678

<!-- gh-comment-id:852422840 --> @catthehacker commented on GitHub (Jun 1, 2021): @merlinpatt please see #678
Author
Owner

@sooyean-hoo commented on GitHub (Jun 7, 2024):

Google until I am super - stress.... All I want to do was to just get out the runner... I would suggest a simple walkthru or some use case to run some of this stuff...

To put it simply, a happy flow to make ppl who are stressed happy.....

Anyway u can try this.. just add

GITHUB_TOKEN=[insert token or leave blank for secure input]

To a file called .secrets

For me, It will work.... please use the actual token.... : stating the obvious... E.g.

GITHUB_TOKEN=ghp_asdsajndsjkabckjlasvljkdsbvljkafbvlhfbvuybeiveuerbvhreb932432bjkf
<!-- gh-comment-id:2153865480 --> @sooyean-hoo commented on GitHub (Jun 7, 2024): Google until I am super - stress.... All I want to do was to just get out the runner... I would suggest a simple walkthru or some use case to run some of this stuff... **To put it simply, a happy flow to make ppl who are stressed happy.....** Anyway u can try this.. just add ```bash GITHUB_TOKEN=[insert token or leave blank for secure input] ``` To a file called `.secrets` For me, It will work.... please use the actual token.... : stating the obvious... E.g. ```bash GITHUB_TOKEN=ghp_asdsajndsjkabckjlasvljkdsbvljkafbvlhfbvuybeiveuerbvhreb932432bjkf ```
Author
Owner

@sikha-root commented on GitHub (Jul 29, 2024):

Since we live in a Google world...

If you really need to use a token (likely if you're using any action that expects github.token), then

act -s GITHUB_TOKEN="$(gh auth token)"

(or any variant) should suffice for those who have GH CLI already configured, assuming your user has the right permissions. But to state the obvious, this can let act make actual changes to things, so use it with intent and caution.

<!-- gh-comment-id:2257078103 --> @sikha-root commented on GitHub (Jul 29, 2024): Since we live in a Google world... If you really need to use a token (likely if you're using any action that expects `github.token`), then ```bash act -s GITHUB_TOKEN="$(gh auth token)" ``` (or any variant) should suffice for those who have GH CLI already configured, assuming your user has the right permissions. But to state the obvious, this can let `act` make actual changes to things, so use it with intent and caution.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#162
No description provided.