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

后端 未结 10 2096
有刺的猬
有刺的猬 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:38

    This is an excellent Stack Overflow question, and the answers have been very instructive, such that I was able to resolve an annoying problem I ran into recently.

    The organization that I work for uses Atlassian's BitBucket product (not Github), essentially their version of GitHub so that repositories can be secured completely on premise. I was running into a similar problem as @coordinate, in that my password was required for a new repository I checked out. My credentials had been saved globally for all BitBucket projects, so I'm not sure what prompted the loss of credentials.

    In short, I was able to enter the following GIT command (supplying only my username), which then prompted Git's Credential Manager to prompt me for the password, which I was then able to save.

    git clone https://user@code.domain.org/git/[organization]/[team]/[repository.git]
    

    NOTE: the bracketed directory sub-paths simply refer to internal references, and will vary for you!

提交回复
热议问题