This repository has been archived by the owner on May 18, 2023. It is now read-only.
forked from terabyte/jgit
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
nazoking edited this page Nov 27, 2014
·
15 revisions
jgit can put remote repository on amazon-s3.
this is jgit-cli integration for jgit-chef.
create auth file as "~/.jgit_s3"
accesskey: [access ID for AWS]
secretkey: [secret key for AWS]
acl: private
and
git remote add s3 amazon-s3://.jgit_s3@backet-name/repo/dir.git
jgit push s3
jgit clone amazon-s3://.jgit_s3@backet-name/repo/dir.git
see http://www.fancybeans.com/blog/2012/08/24/how-to-use-s3-as-a-private-git-repository/
you can use STS AWS Security Token Service.
add token=
in jgit auth file.
for example, create auth file from IAM-ROLE
ROLE=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/`
curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE} | ruby -rjson -rostruct -e 'j=OpenStruct.new(JSON.parse(STDIN.read));puts "accesskey=#{j.AccessKeyId}\nsecretkey=#{j.SecretAccessKey}\ntoken=#{j.Token}"' > ~/.jgit_iam
jgit clone amazon-s3://.jgit_iam@backet-name/repo/dir.git
IAM-ROLE AWS instance profiles credential. you not need auth file.
install in ec2 instance and run
jgit clone amazon-s3://IAM@backet-name/repo/dir.git
( IAM
is static keyword )
export AWS_ACCESS_KEY_ID=[access ID for AWS]
export AWS_SECRET_KEY=[secret key for AWS]
# export AWS_SESSION_TOKEN=[ token if you need ]
jgit clone amazon-s3://ENV@backet-name/repo/dir.git
( ENV
is static keyword )
Valiable names are same as aws-sdk-java.
jgit ls-remote amazon-s3://IAM@backet-name/repo/dir.git master