用于git push命令的用户名和密码 [英] Username and password in command for git push

查看:332
本文介绍了用于git push命令的用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以克隆一个git仓库,在命令中指定用户名和密码。示例:

git clone https://用户名:password@myrepository.biz/file.git



推送时是否可以指定用户名和密码?因此,例如,运行 git push origin --all 然后会输出询问密码。我想要一个命令。



(我知道设置密钥和其他解决方案的能力,但我想知道是否有办法只保留使用用户名和密码一个命令。)我在Windows 8.1上运行Git Bash。

解决方案

是的, p>

git push https:// username:password@myrepository.biz/file.git --all



在这种情况下 https://用户名:password@myrepository.biz/file.git 替换原始 git push origin --all



要查看 git push ,试试 git help push


It's possible to clone down a git repository, specifying username and password in the command. Example:

git clone https://username:password@myrepository.biz/file.git

Is it is possible to also specify the username and password when pushing? So that, for example, running git push origin --all will then output asking for a password. I want this in one command.

(I am aware of the ability to set up keys and other solutions, but I want to know if there is a way to just keep using username and password with one command.) I am running Git Bash on Windows 8.1.

解决方案

Yes, you can do

git push https://username:password@myrepository.biz/file.git --all

in this case https://username:password@myrepository.biz/file.git replace the origin in git push origin --all

To see more options for git push, try git help push

这篇关于用于git push命令的用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆