简体   繁体   中英

Clone Git using using username and password?

I have a batch file that will open a application git-cmd. When trying to clone a git repository, i'm getting prompt to enter password on the git-cmd. I want to do it all from the batch file. Is there a command from the batch file that will enter the password automatically to the gmd-cmd and not the windows cmd?

Here's my git connection on git-cmd: git clone username@git.hostname.com/file.git

If you are using https to clone your repository you can put your username and password in URL like this:

git clone https://username:password@git.hostname.com/file.git

However this is a security issue as you expose your password, so be careful.

Check also this topic to get more detailed answers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM