简体   繁体   中英

Git pull/clone with username and password in AWS Code Commit

I Need to do a git pull using https url as a oneline command . this command I need to integrate in a bash script . But all the time it is asking the usernmae and password .

The repository is in AWS codecommit

Check this link: Enter user password in command

As is described perfectly in that post, you basically have three options:

  1. Store the password in .netrc file (with 600 permissions). Make sure you clone the repo specifying the username in the url.
  2. Clone the repo with https://user:pass@domain/repo . Take into account that your password will be visible in several places...
  3. Use the credential helper .

Try this:

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

This way worked for me for CodeCommit ( AWS ) repository

As an update, AWS has released their remote git remote codecommit. With proper IAM setup, you can do oneline pulls without even passing username and passwords. This is now the recommended method by AWS. It can be setup on your local or on a container that's running in an AWS Pipeline for example.

ie git clone codecommit://HelloWorldRepo myLocalHelloWorldRepo And then you can git pull as normal.

Full documentation is here: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM