Adding a New Repository to Git/Gitosis
It’s been a while since I used my own git server. I’m pulling together a bunch of management scripts into a toolbox to take with me from server to server and wanted to make a new repository.
Except I had no idea what to do to make a new one and I don’t seem to have written it down last time since it seemed so obvious at the time.
So, here’s the scoop…
To create new repositories:
- Add the project to the gitosis configuration
- Make them writable for the user you want to push as
- Push up the gitosis-admin configuration
- Create a new home for the project
- Initialize it as a git repository
- Copy all your project files into the new repository directory
- Add them all to the git repository
- Commit everything
- Push to the server
For example: let’s assume your username is ‘jdoe’ and you want to create a repository ‘myproject’.
In your clone of your server’s gitosis-admin, edit ‘gitosis.conf’ and add::
[group exampleproject] members = jdoe writable = myproject
Commit that change and push the changed gitosis configuration.
# git commit -a -m "Added new group 'exampleproject' and project 'myproject'"
# git push
Then create the local repository:
# mkdir myproject
# cd mypyroject
# git init
# ...copy all your project files in...
# git commit -a -m "First commit"
Set it up to push to the remote:
# git remote add myserver gitosis_user@yourserver.com:myproject.git
Do some work, add, commit everything then push it up:
# git commit -a -m "Putting away before first push to server"
# git push myserver master:refs/heads/master
That’s it. You now have a new project up on your git server and every time you do a git push it’ll go up.
No comments yet.