如何自动化"拉推"过程?(git) 使用用户名和密码身份验证



如何自动化"拉推"过程?(吉特(用户名和密码身份验证

所以我写了一个 bash 文件如下,但在该过程之后,另一个 git 服务器提示输入用户名和密码作为身份验证,我该如何编写该脚本。另外,如果我当前的脚本没问题?手动一切正常

#!/bin/bash
cd /home/****/Desktop/test
git clone --bare https://gitlab.com/***/pullpush.git
cd /pullpush.git
git push --mirror https://ip_address/***/test-project.git

你应该使用 ssh 而不是 https 来处理 git。您可以在此处找到文档:

https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account

这不会提示您输入任何密码。

假设由于某种原因您不能使用 ssh,并且除了使用 https 之外别无选择,那么您可以创建一个个人令牌,并且也不会收到密码提示。文档在这里 :

https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

最新更新