【问题标题】:Git command using shell script使用 shell 脚本的 Git 命令
【发布时间】:2016-12-10 12:18:08
【问题描述】:

我已经为 git push 设置了命令。

commit_message="aaaa"

git add .

git commit -m "commit_message"

git push origin master

但每次我都必须为此设置用户名和密码。

任何人都可以帮助我在不输入用户名和密码的情况下创建脚本,例如如何在该 shellscript 文件上感受自动用户名和密码。

【问题讨论】:

  • 使用ssh克隆存储库。

标签: linux git shell unix


【解决方案1】:

您应该使用sshclone 存储库。一旦通过ssh 克隆了存储库。它不会要求输入密码。

请加git remote set-url origin git@host_name:user_name/repo.git

【讨论】:

    【解决方案2】:

    如果你在远程url中使用http(s?)://协议,那么你可以修改为:

    git remote set-url https://my_git_username:my_super_secret_password@git_server/repo.git
    

    【讨论】:

      猜你喜欢
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 2014-12-23
      • 1970-01-01
      • 2011-11-13
      • 1970-01-01
      • 2014-12-13
      • 1970-01-01
      相关资源
      最近更新 更多