Publish to S3 using Git?
1 Use JGit via http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html
Download jgit.sh, rename it to jgit and put it in your path (for example $HOME/bin).
Setup the .jgit config file and add the following (substituting your AWS keys):
$vim ~/.jgit
accesskey: aws access key
secretkey: aws secret access key
Note, by not specifying acl: public in the .jgit file, the git files on S3 will be private (which is what we wanted). Next create an S3 bucket to store your repository in, let’s call it git-repos, and then create a git repository to upload:
s3cmd mb s3://git-repos
mkdir chef-recipes
cd chef-recipes
git init
touch README
git add README
git commit README
git remote add origin amazon-s3://.jgit@git-repos/chef-recipes.git
In the above I’m using the s3cmd command line tool to create the bucket but you can do it via the Amazon web interface as well. Now let’s push it up to S3 (notice how we use jgit whenever we interact with S3, and standard git otherwise):
jgit push origin master
Now go somewhere else (e.g. cd /tmp) and try cloning it:
jgit clone amazon-s3://.jgit@git-repos/chef-recipes.git
When it comes time to update it (because jgit doesn’t support merge or pull) you do it in 2 steps:
cd chef-recipes
jgit fetch
git merge origin/master
2 Use FUSE-based file system backed by Amazon S3
Get an Amazon S3 account!
Download, compile and install. (see InstallationNotes)
Specify your Security Credentials (Access Key ID & Secret Access Key) by one of the following methods:
using the passwd_file command line option
setting the AWSACCESSKEYID and AWSSECRETACCESSKEY environment variables
using a .passwd-s3fs file in your home directory
using the system-wide /etc/passwd-s3fs file
do this
.
/usr/bin/s3fs mybucket /mnt
That's it! the contents of your amazon bucket "mybucket" should now be accessible read/write in /mnt
Dandelion is another CLI tool that will keep Git repositories in sync with S3/FTP/SFTP: http://github.com/scttnlsn/dandelion