CommunityData:Git: Difference between revisions

From CommunityData
(→‎Creating a new repository: updating initial push instructions)
Line 15: Line 15:
== Creating a new repository ==
== Creating a new repository ==


To create a new repository, you will need to have admin rights, and you will need to clone the gitolite-admin repository
To create a new repository, you will need to have admin rights. Currently, the administrators are Nate, Jeremy, Aaron, and Mako. If you'd like to be an administrator, you should contact one of them!


<code>$ git clone git@code.communitydata.cc:gitolite-admin</code>
=== Details for Administrators ===
 
If you are all already administrator, this describes how you will create a new repository.
 
First, you will need to clone the gitolite-admin repository
 
:$ git clone git@code.communitydata.cc:gitolite-admin


And then edit the file <code>conf/gitolite.conf</code>. To add a new project, simply create a new entry at the bottom of the file.
And then edit the file <code>conf/gitolite.conf</code>. To add a new project, simply create a new entry at the bottom of the file.

Revision as of 03:13, 15 January 2016

Introduction

We have a private git server which uses gitolite to manage permissions for git repositories.

Dependencies

To get started, you will need a public SSH key. You can send your public key (usually ~/.ssh/id_rsa.pub) to a current administrator (probably Mako), and they can add you as a new user.

You will also need to have git installed.

Cloning a repository

"Cloning" a repository downloads the files, as well as the history, of a repository. It also creates

Creating a new repository

To create a new repository, you will need to have admin rights. Currently, the administrators are Nate, Jeremy, Aaron, and Mako. If you'd like to be an administrator, you should contact one of them!

Details for Administrators

If you are all already administrator, this describes how you will create a new repository.

First, you will need to clone the gitolite-admin repository

$ git clone git@code.communitydata.cc:gitolite-admin

And then edit the file conf/gitolite.conf. To add a new project, simply create a new entry at the bottom of the file.

For example,

repo foo
    RW+ = aaron mako
    R   = jdfoote

would create a new repository at git@code.communitydata.cc:foo with aaron and mako as admins, and give jdfoote read-only access *once this file was saved, committed, and pushed*.

You could then go to wherever the files are that you would like to track, and add this repository as a remote, like so:

$ cd foo
$ git init
$ git remote add origin git@code.communitydata.cc:foo
$ git add ./ # Adding everything to be tracked in git
$ git commit 
$ git push origin master

If this project already exists in git, then it's even easier. Just change the remote, and push it.

$ git remote set-url origin git@code.communitydata.cc:foo
$ git push

Adding new users

To add new users, simply add their public key to the keydir/ directory, renamed as username.pub