How do I provide a username and password when running “git clone git@remote.git”?

后端 未结 10 2085
有刺的猬
有刺的猬 2020-11-22 07:00

I know how to provide a username and password to an HTTPS request like this:

git clone https://username:password@remote

But I\'d like to kn

10条回答
  •  情深已故
    2020-11-22 07:23

    Based on Michael Scharf's comment:

    You can leave out the password so that it won't be logged in your Bash history file:

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

    It will prompt you for your password.

    Alternatively, you may use:

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

    This way worked for me from a GitHub repository.

提交回复
热议问题