【问题标题】:Git pull/clone with username and password in AWS Code Commit在 AWS Code Commit 中使用用户名和密码提取/克隆 Git
【发布时间】:2018-03-31 02:18:12
【问题描述】:

我需要使用 https url 作为单行命令来执行 git pull。我需要将此命令集成到 bash 脚本中。但它一直在询问用户名和密码。

存储库位于 AWS codecommit

【问题讨论】:

  • 阅读一些关于公钥和私钥的ssh 教程,并为git 命令使用git: URL

标签: linux git bash jenkins aws-codecommit


【解决方案1】:

查看此链接:Enter user password in command

正如该帖子中完美描述的那样,您基本上有三个选择:

  1. 将密码存储在 .netrc 文件中(具有 600 个权限)。确保克隆 repo,并在 url 中指定用户名。
  2. 使用https://user:pass@domain/repo 克隆repo。考虑到您的密码会在多个地方显示...
  3. 使用credential helper

【讨论】:

    【解决方案2】:

    试试这个:

    git clone https://username:password@git-codecommit.us-east-1.amazonaws.com/v1../repos../..
    

    这种方式适用于 CodeCommit (AWS) 存储库

    【讨论】:

      【解决方案3】:

      作为更新,AWS 发布了他们的远程 git 远程代码提交。通过正确的 IAM 设置,您甚至可以在不传递用户名和密码的情况下进行单线拉取。这是 AWS 现在推荐的方法。例如,它可以在您的本地或在 AWS Pipeline 中运行的容器上设置。

      git clone codecommit://HelloWorldRepo myLocalHelloWorldRepo 然后你可以照常git pull

      完整的文档在这里: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html

      【讨论】:

        猜你喜欢
        • 2015-11-26
        • 1970-01-01
        • 2015-06-04
        • 2017-06-02
        • 2020-09-24
        • 2018-03-27
        • 1970-01-01
        • 2022-07-19
        • 2021-03-18
        相关资源
        最近更新 更多