Skip to content

Instantly share code, notes, and snippets.

@muzhig
Created January 5, 2013 08:12
Show Gist options
  • Save muzhig/4460471 to your computer and use it in GitHub Desktop.
Save muzhig/4460471 to your computer and use it in GitHub Desktop.
GITOLITE
gitolite admin repo – this is where you add new repos, users, and access.
git clone ssh://gitolite@hostname_or_ip:ssh_port/gitolite-admin
You now have a gitolite-admin directory with conf/ and keydir/ inside. Conf directory contains gitolite.conf file and you will add users, privileges and projects/repos here. Keydir is where you save the ssh key files. Note: Make sure the filename of ssh key matches the user on gitolite.conf without the .pub. As example, you will have your ssh key file in keydir/user.pub and in gitolite.conf you have the following:
repo gitolite-admin
RW+ = user
To add users, upload the ssh key file inside keydir/ and add his access inside gitolite.conf.
vi keydir/user2.pub
To create new repository, just add the following lines in conf/gitolite.conf:
repo drupal_dev
RW+ = user user2
RW+ means read, write, and non-fast-forward write or push. Refer to gitolite docs for more info.
You can also create a group that you can use if have several repositories and different users. You’ll have something like this on your conf/gitolite.conf:
@group_name = user user2
repo drupal_dev2
RW+ = @group_name
Do “git add keydir/*; git push -am "message"; git push” to update your gitolite configuration and initialize the repositories.
Create and add contents to repository
Go to drupal devsite (ex: /var/www/html/drupal), initialize the repo, add ignore files and add to origin/master branch.
chown -R gitolite.www-data /var/www/html/drupal **gitolite needs to own the files
cd /var/www/html/drupal
vi .gitignore **add files or directories that you want to exclude**
git init
git remote add origin ssh://gitolite@hostname_or_ip:ssh_port/drupal_dev
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git add .
git commit -am
git push origin master
You can now edit files on /var/www/html/drupal and push to your origin repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment