checkout icon indicating copy to clipboard operation
checkout copied to clipboard

URLs in `.gitmodules` starting with `ssh://` do not work.

Open sandeepd-nv opened this issue 11 months ago • 3 comments

You'll need to use an SSH key instead of a PAT if any URL in your .gitmodules file starts with ssh:// instead of https:// or [email protected]: otherwise GitHub will fail to clone the submodule in question with a Host key verification failed error.

sandeepd-nv avatar May 15 '25 11:05 sandeepd-nv

Good afternoon, encountered a similar problem using deploy-key ssh and private submodule

In .gitmodules I specified

[submodule "SubModuleRepo"]
    path = SubModuleRepo
    url = [email protected]:Org/SubModuleRepo.git

I also tried to specify absolute path but I get the same error

    url = ssh://[email protected]:Org/SubModuleRepo.git.

When I try to download the sub module I get the error

[email protected]: Permission denied (publickey). 
Error: fatal: Could not read from remote repository.
  
Please make sure you have the correct access rights
and the repository exists.
Error: fatal: clone of '[email protected]:Org/SubModuleRepo.git' into submodule path "<<builder_path>>"

In pipeline:

- name: Checkout repository
  uses: actions/checkout@v4
  with:
    submodules: recursive
    ssh-key: ${{ secrets.DEPLOY-KEY}}

Could you show in detail your settings and how exactly you solved this problem?

PanDeOps avatar Jul 09 '25 10:07 PanDeOps

Hi, I also encountered the same problem using deploy-key ssh and private submodule. My solution is to use the https instead of ssh in .gitmodules, and try token in .yml:

- name: Checkout repository
        uses: actions/checkout@v4
        with:
          submodules: true
          token: ${{ secrets.GITHUB_TOKEN }}

yyh12138 avatar Jul 11 '25 01:07 yyh12138

Unfortunately, this step only rewrites [email protected]: URLs, not ssh://github.com/ ones: https://github.com/actions/checkout/blob/ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493/src/git-auth-helper.ts#L67

herrernst avatar Oct 02 '25 09:10 herrernst