问题描述
有谁知道如何做到这一点?到目前为止,我一直无法通过谷歌找到有用的东西。
Does anyone know how to do this? So far I haven't been able to find anything useful via Google.
我真的想设置一个本地回购,并使用混帐推
将其发布到S3,其用意就是具有本地版本控制资产,但在远程存储S3。
I'd really like to setup a local repo and use git push
to publish it to S3, the idea being to have local version control over assets but remote storage on S3.
可以这样做,如果是这样,怎么样?
Can this be done, and if so, how?
推荐答案
1通过的使用JGit http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html
下载jgit.sh,其重命名为jgit,并把它放在你的路径(例如$ HOME /箱)。
Download jgit.sh, rename it to jgit and put it in your path (for example $HOME/bin).
设置的.jgit配置文件,并添加以下(替换您的AWS键):
Setup the .jgit config file and add the following (substituting your AWS keys):
$ VIM〜/ .jgit
$vim ~/.jgit
accesskey: aws access key
secretkey: aws secret access key
请注意,不指定访问控制列表:在.jgit文件公开,S3的git的文件将是私有的(这正是我们想要的)。接下来创建一个S3存储来存储你的资料库中,让我们把它叫做混帐回购协议,然后创建一个Git仓库上传:
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
在上面我使用的s3cmd命令行工具来创建桶,但你可以通过亚马逊Web界面做得一样好。现在,让我们将其推至S3(注意我们是如何使用jgit每当我们与S3交互,以及标准的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
现在去别的地方(如CD / tmp目录),并尝试克隆它:
Now go somewhere else (e.g. cd /tmp) and try cloning it:
jgit clone amazon-s3://.jgit@git-repos/chef-recipes.git
当谈到时间来更新它(因为jgit不支持合并或拉)你这样做2个步骤:
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
-
获取一个Amazon S3帐户!
Get an Amazon S3 account!
下载,编译和安装。 (见InstallationNotes)
Download, compile and install. (see InstallationNotes)
指定您的安全凭证(访问密钥ID和放大器;秘密访问键)通过以下方法之一:
Specify your Security Credentials (Access Key ID & Secret AccessKey) by one of the following methods:
-
使用passwd_file命令行选项
using the passwd_file command line option
设置AWSACCESSKEYID和AWSSECRETACCESSKEY环境变量
setting the AWSACCESSKEYID and AWSSECRETACCESSKEY environment variables
使用你的home目录下.passwd-s3fs文件
using a .passwd-s3fs file in your home directory
使用系统级/ etc / passwd文件,s3fs文件
using the system-wide /etc/passwd-s3fs file
做到这一点
/usr/bin/s3fs mybucket /mnt
这就是它!您的Amazon斗mybucket的内容,现在应该是可访问的读/写在/ mnt下
That's it! the contents of your amazon bucket "mybucket" should now be accessible read/write in /mnt
这篇关于使用Git发布到S3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!