Difference between revisions of "Using git@school"

From Klaus' wiki
Jump to: navigation, search
(User creation)
(Users from your devhost)
Line 32: Line 32:
<source lang="bash">
<source lang="bash">
$ scp ~/.ssh/id_rsa.pub <your-username>@bren.hih.au.dk:/home/git-server/<your-username>/<your-username-on-bren>@<hostname for your devhost>.pub
$ scp ~/.ssh/id_rsa.pub <your-username>@bren.hih.au.dk:/home/git-server/<your-bren-username>/<your-devhost-username>@<hostname-for-your-devhost>.pub

Revision as of 07:23, 9 October 2013

git is available for you to store and share your projects.

The is a local git-server - a virtual machine running on top of bren. It is known on bren.

User creation

We're using gitolite (see here) for further details.

The is a page instructing how to access the git-server here. Do also read the fine detailed instructions just below here.

Users from bren

Note:The following instructions requires you to perform them on bren, i.e. log-in to bren.

In order to be able to store projects on git-server you need to be created on the server.

If you haven't done it already, you have to create a ssh key-pair - see Linux hints how to create your ssh key-pair.

Next issue this command:

$ cd /home/git-server
$ mkdir <your username>
$ chmod 700 <your username>
$ cd <your username>
$ cp ~/.ssh/id_rsa.pub <your username>.pub

Users from your devhost

Your public ssh-key on your devhost can be used for accessing git-server as explained above for bren. Prepare one if you haven't done that already.

$ scp ~/.ssh/id_rsa.pub <your-username>@bren.hih.au.dk:/home/git-server/<your-bren-username>/<your-devhost-username>@<hostname-for-your-devhost>.pub


$ scp .ssh/id_rsa.pub klausk@bren.hih.au.dk:/home/git-server/klausk/klausk@`hostname`.pub

The `hostname` is a program that executes and returns the local hostname on stdout and is put into the text, so the line on my devhost expands to klaus-centos5.bren.hih.au.dk

Users from a Windows git program

Find the public key in the program and prepare a public keyfile as described under Putty

Use the same naming convension as described above for devhost - be sure to edit the file as described [here].

Prepare a project repository

$ vi projectname

For every <your username> you will of-course put in your login on bren.

when the editor opens add these lines:

repo <your reponame>
    RW+ = <list of users that shall have read, write and ''add new files access''>
    RW  = <list of logins that shall have read and write access>
    R   = <list of logins that shall have read access>

following the rules as pointed out on this page.

NOTE: Be sure to follow the edit rules with the repo name and on the immediate next line(s) the access indented as shown above - no empty lines between repo name and the users

You can add several usernames if needed - you should just provide one username.pub file per username in the same directory.

Finally you write a mail to klausk (at) iha [dot] dk asking to have the entries created on the git-server. When you receive an email back everything should be working.

Create the remote project

On bren create a project directory in your home directory or below that.

cd into the directory.


$ git init
$ touch afile
$ git add afile
$ git commit -m 'a message'

Now you have an empty git repository containing one empty file - afile.

To push the project onto the git-server issue:

$ git remote add origin git@git-server:<your-projectname>
$ git push origin master

If no errors your project is now master on the git-server and you can push changes or pull earlier versions.