igorette (owner)

Revisions

gist: 59551 Download_button fork
public
Public Clone URL: git://gist.github.com/59551.git
Embed All Files: show embed
create_remote_webroot_from_local_repository_with_git.sh #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
 
# create a remote git repository with ssh
# from a existing local repository
# stores git meta data seperate from data
# useful e.g. for webroot
# based on http://toroid.org/ams/git-website-howto
# use "git push www" later for updates
 
NAME="www"
WEBROOT="/var/www"
REPOPATH="/user/igorette/vcs"
SSHID="${HOME}/.ssh/ec2-keys/id_test123"
HOST="hostname.com"
SSHHOST="ssh://${HOST}${REPOPATH}/${NAME}.git"
 
ssh -t -i ${SSHID} ${HOST} "
cd ${REPOPATH} && \
mkdir ${NAME}.git && \
cd ${NAME}.git && \
git init --bare && \
git config core.worktree ${WEBROOT} && \
git config core.bare false && \
echo '#!/bin/sh' > hooks/post-receive && \
echo 'git checkout -f' >> hooks/post-receive && \
chmod +x hooks/post-receive
"
git remote add ${NAME} ${SSHHOST}
git push ${NAME} +master:refs/heads/master