Checkout: Submodules from private repositories

Created on 9 Sep 2019  路  4Comments  路  Source: actions/checkout

Apologies if this has already come up...I haven't been able to find an answer to this.

I'm attempting to setup Actions for a private GitHub repo. The repo pulls in two submodules, each of which are also private GitHub repos. My Action fails on checkout with ##[error]fatal: Could not read from remote repository.

How do I configure the checkout action with the right credentials to pull in these private submodules?

This is what I currently have for the checkout step as a starting point:

    - uses: actions/checkout@v1
      with:
        submodules: true

Most helpful comment

You can use too:

    - name: Fix up git URLs
      run: |
        git config --global --add url."https://${{ secrets.GITHUB_SECRET }}:[email protected]/".insteadOf "https://github.com/"
        git config --global --add url."https://${{ secrets.GITHUB_SECRET }}:[email protected]/".insteadOf "[email protected]:"

All 4 comments

I think u need #14

- uses: actions/checkout@v1
   with:
        submodules: true
        token: ${{ secrets.CI_TOKEN }}

CI_TOKEN is a workflow secret & a personal access token, u can configure in the settings section.

Oh! Perfect thanks, that solved my issue :)

You can use too:

    - name: Fix up git URLs
      run: |
        git config --global --add url."https://${{ secrets.GITHUB_SECRET }}:[email protected]/".insteadOf "https://github.com/"
        git config --global --add url."https://${{ secrets.GITHUB_SECRET }}:[email protected]/".insteadOf "[email protected]:"

If you are using 2fa or SAML don't forgot to enable SSO on your TOKEN from within your account settings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bk2204 picture bk2204  路  3Comments

gitfool picture gitfool  路  3Comments

KOLANICH picture KOLANICH  路  4Comments

kooyear picture kooyear  路  7Comments

zeke picture zeke  路  7Comments