How to use SSH instead of HTTP for Git submodules?

后端 未结 2 1129
遥遥无期
遥遥无期 2021-01-12 17:12

Why are people having this problem?

$ git clone --recursive git@github.com:acani/Chats.git Cloning into \'Chats\'... Permission denied (publickey). fatal: Could not

相关标签:
2条回答
  • 2021-01-12 17:17

    As a workaround, you can try using https url for any github repo:

    cd myParentRepo
    git config url.https://github.com/.insteadOf ssh://git@github.com/
    # or
    git config url.https://github.com/.insteadOf git@github.com:
    
    0 讨论(0)
  • 2021-01-12 17:27

    The SSH protocol doesn’t support anonymous access to a Git repository.

    So, don't use the SSH protocol. Instead, use either the Smart HTTP protocol (recommended) or the Git protocol.

    For every submodule URL in your repository's .gitmodules file, replace git@github.com: with either https://github.com/ (to use the Smart HTTP protocol) or git://github.com/ (to use the Git protocol).

    More info: Git - The Protocols

    0 讨论(0)
提交回复
热议问题