peterc (owner)

Revisions

gist: 198184 Download_button fork
public
Description:
Create and sync a new git repository on Dreamhost
Public Clone URL: git://gist.github.com/198184.git
Embed All Files: show embed
newgit #
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
31
# Create a new git repository on Dreamhost
# Function tweaked from that found at http://craigjolicoeur.com/blog/hosting-git-repositories-on-dreamhost
#
# Just add the code below to your .bashrc.
# Usage:
# newgit some-repo.git
#
# Then locally:
#
# git push --all ssh://$MACHINE/home/$USER/git/my-new-repos.git
# git remote add origin ssh://$MACHINE/home/$USER/git/my-new-repos.git
# git config branch.master.remote origin
# git config branch.master.merge refs/heads/master
# git fetch
# git merge master
 
newgit()
{
    if [ -z $1 ]; then
        echo "usage: $FUNCNAME project-name.git"
    else
        gitdir="/home/$USER/git/$1"
        mkdir $gitdir
        pushd $gitdir
        git --bare init
        git --bare update-server-info
        chmod a+x hooks/post-update
        touch git-daemon-export-ok
        popd
    fi
}