Can I add a username & password to git clone using the --recursive option (for submodules)?

前端 未结 1 1750
梦毁少年i
梦毁少年i 2021-02-05 11:22

I am using git to clone a repo via https thus:

git clone https://username:password@alocation/git/repo.git

This is fine but it has a large numbe

相关标签:
1条回答
  • 2021-02-05 11:49

    The credentials should be valid for any submodules with an address supposed to accept them.

    One only case where it could fail is when the .gitmodules file points to another repo, as illustrated by the case 214 of the Hunch Kod project.

    To make sure those credentials are passed to every request to 'alocation' server, you don't need to tweak anything in Git, but this is probably a ssh, curl or http proxy settings.

    I would rule out ssh (alocation wouldn't execute anything as 'username' but would rather have a dedicated user account).

    Check your http_proxy and https_proxy environment variable if you have a proxy.

    But try also a simple curl https://alocation/git/repo.git:
    With a $HOME/.netrc (%HOME%\_netrc on Windows), you can specify the login/password expected.

    machine alocation
      login username
      password mypassowrd
    

    If that work for https://alocation/git/repo.git (i.e. without asking you for a username and password), it will work for any other repo( here submodules).

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