可以克隆一个git存储库,在命令中指定用户名和密码.例:
git clone https://username:password@myrepository.biz/file.git
是否可以在推送时指定用户名和密码?因此,例如,运行git push origin --all
将输出要求输入密码.我希望在一个命令中.
(我知道设置密钥和其他解决方案的能力,但我想知道是否有办法只使用一个命令继续使用用户名和密码.)我在Windows 8.1上运行Git Bash.
num*_*er5 131
是的,你可以做到
git push https://username:password@myrepository.biz/file.git --all
在这种情况下,https://username:password@myrepository.biz/file.git
替换origin
ingit push origin --all
要查看更多选项git push
,请尝试git help push
小智 15
我使用以下格式
git push https://username:password@myrepository.biz/file.git --all
如果您的密码或用户名包含@,请用%40替换
Chr*_*ams 15
对于任何有特殊字符密码问题的人,只需省略密码,它会提示您输入:
git push https://YOUR_GIT_USERNAME@github.com/YOUR_GIT_USERNAME/yourGitFileName.git
Run Code Online (Sandbox Code Playgroud)
Moh*_*taz 12
2021 年 8 月 13 日删除了对密码身份验证的支持。您可以改用个人访问令牌。就像下面的推送命令:
git push https://<User Name>:<Token>@github.com/<User Name>/<Your Repository>.git
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
145530 次 |
最近记录: |