Clone a private repo of github with username and password

后端 未结 2 864
心在旅途
心在旅途 2021-01-31 04:18

I have configured Account A on my system with Global configurations and I can clone all my repos from there.

Now I don\'t want to change the configuration and I want to

2条回答
  •  无人及你
    2021-01-31 04:43

    You can try with the complete https url:

    git clone https://username:password@github.com/*****/******.git
    

    If you omit the https:// part (and use ':' instead of '/'), it would be interpreted like an ssh url.

    The GitHub help page "Which remote URL should I use?" confirms an https url can access private repos.

    Note: I wouldn't put the password directly in the url, but use a credential manager to get the right password for the right user.

    git clone https://username@github.com/*****/******.git
    

提交回复
热议问题