If you already have a local git repository that you want to host on compsoc, then you can skip this first step.
Initialise a new git repository in the directory of the project you want to host (this will be the copy you have at home, for example)
[simon@simon ~]$ cd ~/project/foo/ [simon@simon foo (master #)]$ git init Initialized empty Git repository in /home/simon/project/foo/.git/
Log in to compsoc, and create a new directory where you want your repository stored and initialise a bare git repository there.
[simon@forgetful ~]$ mkdir foo.git [simon@forgetful ~]$ cd foo.git/ [simon@forgetful foo.git]$ git --bare init Initialized empty Git repository in /data/home/simon/foo.git/ [simon@forgetful foo.git (BARE:master)]$
On your home machine you will need to add compsoc as a remote, here I've referred to compsoc as "origin".
[simon@simon foo (master #)]$ git remote add origin simon@forgetful.compsoc.man.ac.uk:foo.git
Do some editing, commit some changes locally (i.e. at home).
[simon@simon foo (master #)]$ vim hello_world.c [simon@simon foo (master #)]$ git add hello_world.c [simon@simon foo (master #)]$ git commit -m "Added test file" [master (root-commit) 76e25d7] Added test file 1 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 hello_world.c
Use git push to push your local changes to compsoc.
[simon@simon foo (master)]$ git push origin master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 302 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To simon@forgetful.compsoc.man.ac.uk:foo.git * [new branch] master -> master
If you want to put your git repository on the internet, either copy or symlink the foo.git directory to be in your public_html directory and run git update-server-info.
[simon@forgetful public_html]$ cd ~/public_html/ [simon@forgetful public_html]$ ln -s ../foo.git/ [simon@forgetful ~]$ cd foo.git/ [simon@forgetful foo.git (BARE:master)]$ git --bare update-server-info [simon@forgetful foo.git (BARE:master)]$ chmod a+x hooks/post-update
Now anyone can come along and clone your git repository.
[simon@simon ~]$ cd /tmp [simon@simon tmp]$ git clone http://compsoc.man.ac.uk/~simon/foo.git Cloning into foo... [simon@simon tmp]$ cd foo/ [simon@simon foo (master)]$ cat hello_world.c #includeint main() { printf("hello, world!\n"); return 0; }
Thanks for reading!