git - 如何在推送命令期间提供 git 凭据?
问题描述
我正在使用 windows powershell 创建一个自动化脚本,该脚本将克隆一个 repo,对其进行一些操作,然后最终推送它。
到目前为止,这是我的代码:
git clone <github-domain>.com/org/repo
cd org/
echo "new content" >> newfile.txt
git add .
git commit -m "added new content"
git push origin master # here I receive a pop up asking me for my username and password
我想知道是否可以在push
命令期间传递用户名和密码,因为这应该是完全自动化的。
就像是:
git push origin master --username a --password b
我尝试在网上查找,但所有来源都指向 ssh,并且没有“自动”的方式来做到这一点。
解决方案
只有第一次,您需要输入密码 请按照以下步骤操作:
git config credential.helper store
git push origin master
# supply username and Password for the 1st time
现在下次他们不要求用户名或密码
谢谢!
推荐阅读
- notepad++ - 使用记事本++从文件中的一组行中选择字符范围
- c# - 如何处理grpc客户端连接错误?
- java - 关于制作一个允许用户从给定列表中选择一本书、输入数量并确认订单的 java 程序的建议
- angular - 我的硬件“后退按钮操作”在 Ionic 4 中不起作用
- javascript - 使用子数组创建数组的函数
- amazon-web-services - 由于大量的 PutMetricData 请求,Cloudwatch 会产生大量成本
- curl - 如何参数化多分支作业 - Jenkins cURL
- java - 使用 Java 中的键对 JSON 进行排序
- python - ValueError:当更改为更大的 dtype 时,其大小必须是数组最后一个轴的总大小(以字节为单位)的除数
- django - Pinax Stripe - 无法向没有活动卡的客户收费