gpt4 book ai didi

linux - 如何自动将答案传递给命令行

转载 作者:行者123 更新时间:2023-12-04 18:58:48 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How can I save username and password in Git?

(28 个回答)


4个月前关闭。




尝试自动化我的 github 身份验证
每当我运行 git push它要求我提供用户名和身份验证
enter image description here
我想自动化它抛出脚本,这样每当它要求用户名时,我的脚本就会通过它
注意:即使是 git push 命令也是通过脚本自动执行的
这是我使用脚本自动化 git push 的方法

read -p "Do you want to push changes? (y/n)" push_choice 
if [ "$push_choice" == "y" ];
then
git push
它不止于此,但在代码命中 git push 命令后,它会要求我输入密码和用户名。
那么这个脚本有什么方法可以传递它需要的所有信息,因为每次它要求相同的用户名并通过

最佳答案

使用带有公钥身份验证的 SSH 而不是密码。
参见例如
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh

关于linux - 如何自动将答案传递给命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71142844/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com