Skip to content

Instantly share code, notes, and snippets.

@taiar
Forked from andris9/git-cache-meta.sh
Last active August 29, 2015 14:28
Show Gist options
  • Save taiar/a1f161f8c0d4a8af251a to your computer and use it in GitHub Desktop.
Save taiar/a1f161f8c0d4a8af251a to your computer and use it in GitHub Desktop.
git-cache-meta
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9
: ${GIT_CACHE_META_FILE=.git_cache_meta}
case $@ in
--store|--stdout)
case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
find $(git ls-files)\
\( -printf 'chown %U %p\n' \) \
\( -printf 'chgrp %G %p\n' \) \
\( -printf 'touch -c -d "%AY-%Am-%Ad %AH:%AM:%AS" %p\n' \) \
\( -printf 'chmod %#m %p\n' \) ;;
--apply) sh -e $GIT_CACHE_META_FILE;;
*) 1>&2 echo "Usage: $0 --store|--stdout|--apply"; exit 1;;
esac

source:

git-cache-meta --store

destination:

git-cache-meta --apply

Download jgit.sh

Config

cat > ~/.jgit
accesskey: aws access key
secretkey: aws secret access key
<Ctrl-D>

Setup repo

git remote add origin amazon-s3://[email protected]/repo-name.git

Push

jgit push origin master

Clone

jgit clone amazon-s3://[email protected]/repo-name.git

Pull

jgit fetch
git merge origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment