Gitolite: adding new repositories
I'm now using Gitolite to manage the git repositories and all the users permissions stuff. Whenever I want to create a new repository I need to recall how to do it and I end up searching for it in Google. Today I've created a bash function and added it to my ~/.bashrc that does all the required stuff.
After adding the corresponding entry to gitolite-admin/conf/gitolite.conf for the new git repository, these are the commands I use to create the repository:
- $ mkdir reponame
- $ cd reponame
- $ git init
- $ git remote add origin git@gitolite:reponame.git
Then, the function I've created ends up as:
- function create_git_repo {
- if [ "$1" == "" ] ; then
- echo "[E] One arg is needed!"
- else
- echo "[!] Make sure you have already defined the repo in the conf/gitolite.conf file! (Ctrl+C if you haven't!)"
- read i
- mkdir ${1} && echo " * Directory successfully created!"
- cd ${1}
- git init
- git remote add origin git@gitolite:${1}.git && echo " * remote origin added"
- echo " * Remember to add some files and push with 'git push origin master:refs/heads/master'..."
fi
- }
Now I can just type create_git_repo reponame to create my new git repo both in my machine and in the gitolite server.
