This assumes that you have a server with GitWeb installed on it already. The file paths are based on Debian.
Create a directory for the new git repo:
$ sudo mkdir /var/cache/git/MyRepo
Then change the permissions so you can use it:
$ sudo chown myusername:myusername /var/cache/git/MyRepo/
Now we need to initialise the repo for GitWeb:
$ cd /var/cache/git/MyRepo
$ git init --bare
Initialized empty Git repository in /var/cache/git/MyRepo/
Then provide an appropriate desciption of your repo by editing the description file:
$ vi description
Clone the new repo:
$ git clone ssh://myusername@my.server.com/var/cache/git/MyRepo
Cloning into 'MyRepo'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done
Create some content:
$ cd ./MyRepo
$ touch me
Then add the file to git
$ git add me
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: me
#
$ git commit -am "Added me"
[master 61e4a60] Added me
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 me
Counting objects: 4, done.
Now push it up to your server:
$ git push
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 268 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://craige@mcwhirter.com.au/var/cache/git/Talks
0a18962..61e4a60 master -> master
If you check your GitWeb instance, you should the repo is now there and your first file is in it.
Happy GitWeb-ing :-)