Solvedcheckout Private repository submodule sync failed.

  • yml setting.
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        ref: develop
        submodules: true
  • actions log
    스크린샷 2019-08-16 오후 3 13 08

Please fix it. 🙏

26 Answers

✔️Accepted Answer

I ran into this same issue and made a slightly different tweak. As part of my workflow I use .gitconfig to tweak the URLs. That way I don't have to switch from using the git protocol to https in my .gitmodules file and affect my development setup.

As my first step in my YAML file, before running actions/checkout with submodules: true:

    - name: Fix up git URLs
      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git@github.com:"' >> ~/.gitconfig

@TingluoHuang I feel like this issue should be reopened if it's not the desired behavior, and if it is I think it needs to be better documented. I can open another issue if that is desirable.

Other Answers:

If this helps anyone, this is working for me:

  • using a/the github token
  • to clone a URL accessed via git@github.com/user/repo.git (maybe via submodules/homebrew/a script/something else)
  • in GH actions
  • with runs-on: [macOS-latest]
# disable the keychain credential helper
git config --global credential.helper ""
# enable the local store credential helper
git config --global --add credential.helper store
# add credential
echo "https://x-access-token:${{ secrets.A_TOKEN }}@github.com" >> ~/.git-credentials
# tell git to use https instead of ssh whenever it encounters it
git config --global url."https://github.com/".insteadof git@github.com:
# do something
git clone git@github.com:user/repo.git

@socar-baegoon did you configure your submodule via ssh? can you try configure your submodule using https://github.com/org/repo format?

Thank you! It works!

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        ref: develop
        token: ${{ secrets.BAEGOON_TOKEN }}
        submodules: true
[submodule "subprojects/protocol/src/main/proto"]
	path = subprojects/protocol/src/main/proto
	url = https://github.com/owner/protocol.git

Related Issues:

40
checkout private submodule checkout fails @v2
@jleni here's a version that will checkout all repositories defined in .gitmodules :) It works for b...
19
checkout RFC: fetch-depth: 1 and not cloning tags are dangerous defaults
Simpler config might also help e.g.: I've had huge problems with github actions specifically because...
17
checkout Private repository submodule sync failed.
I ran into this same issue and made a slightly different tweak As part of my workflow I use .gitconf...
11
checkout bad revision 'master' when using Lerna
So for everyone who lands here via google My workflow looks like: I only need the origin/master If y...