Git repository on this server: Difference between revisions
No edit summary |
|||
| Line 3: | Line 3: | ||
== Getting write access to repositories == | == Getting write access to repositories == | ||
Write access to | Write access to the repositories can only be given to users who sent their Open SSH public key to the [http://rtime.felk.cvut.cz/~sojka/ administrator] together with their university assigned login name (if any). The SSH key can be created in Linux/Unix (or in [http://code.google.com/p/msysgit/ MSysGit] shell in Windows) by: | ||
ssh-keygen | ssh-keygen | ||
| Line 11: | Line 11: | ||
During the key creation you will be asked for a passphrase. If you do not specify any passphrase, anybody with access to your <tt>~/.ssh</tt> directory could access your repositories. If you specify the key, the passphrase will need to be entered whenever to use the key. By using <tt>ssh-add</tt> command you can specify the passphrase only once and the decrypted key will be remembered in the memory. | During the key creation you will be asked for a passphrase. If you do not specify any passphrase, anybody with access to your <tt>~/.ssh</tt> directory could access your repositories. If you specify the key, the passphrase will need to be entered whenever to use the key. By using <tt>ssh-add</tt> command you can specify the passphrase only once and the decrypted key will be remembered in the memory. | ||
== Creating | == Creating repositories == | ||
There are to ways how a repository can be created: | There are to ways how a repository can be created: | ||
Revision as of 15:14, 21 February 2013
Repositories on rtime server are managed by Gitolite tool, which allows to conveniently manage repository permissions. World readable repositories can be browsed online. Alternatively, users with shell account can create Git repositories in their home directory.
Getting write access to repositories
Write access to the repositories can only be given to users who sent their Open SSH public key to the administrator together with their university assigned login name (if any). The SSH key can be created in Linux/Unix (or in MSysGit shell in Windows) by:
ssh-keygen
It is stored by default at ~/.ssh/id_rsa.pub.
During the key creation you will be asked for a passphrase. If you do not specify any passphrase, anybody with access to your ~/.ssh directory could access your repositories. If you specify the key, the passphrase will need to be entered whenever to use the key. By using ssh-add command you can specify the passphrase only once and the decrypted key will be remembered in the memory.
Creating repositories
There are to ways how a repository can be created:
- Send an email to the administrator with the name of the repository, a short description and a list of people (SSH public keys) who should have access to the repository.
- Our group staff members can create their repositories without asking the administrator. See below.
Automatic creation of repositories (staff members only)
It is simply a matter of pushing the repository to a special URL containing the login, like this:
git push --set-upstream ssh://git@rtime.felk.cvut.cz/«login»/«whatever» HEAD
This will create a new repository called «whatever» (if it does not exist yet) and push the current HEAD to it. It also makes this repository the default for pushing and pulling (this is what --set-upstream does).
If you want to set a Gitweb description for repositories created this way, use gitolite's getdesc/setdesc commands. I.e. you can set the description by:
echo "Description" | ssh git@rtime.felk.cvut.cz setdesc «login»/«whatever»
Accessing the repository
After installing Git on your local computer, you can access the repository as follows.
Cloning the repository
Read/Write access (for users with registered SSH key):
git clone ssh://git@rtime.felk.cvut.cz/repo-name
Read-only access (for public repositories only):
git clone git://rtime.felk.cvut.cz/repo-name.git
First push
After an empty repository is created either by admin or by you (automatic), you can push (i.e. upload) the data to it:
- Clone the empty repository.
- Put your sources into your cloned repository
git add . # tells git to track all files in your project git commit # commits the added files to the repository
- Push your sources to the server
git push
Pushing to non-master branches
If you are not allowed to push to the master branch but to a different one, you have to push like this:
git push origin master:your-branch
which pushes your local master branch to the remote branch your-branch.
To make this behavior default run
git config remote.origin.push master:your-branch
And from now on, it is sufficient to run only
git push
Managing central repositories
Finding available repositories
You can find the list of repositories you have access to by running:
ssh git@rtime.felk.cvut.cz info [filter]
where filter is optional string used to filter the list.
It there are wildcard (automatic) repositories, as in the example below, you will only see the wildcard pattern and not the created repositories.
C R W fpga/[a-zA-Z0-9].*
To expand the wildcards, use the command expand instead of info. This command is a way slower than info command!
ssh git@rtime.felk.cvut.cz expand ssh git@rtime.felk.cvut.cz expand fpga
Permissions to automatic repositories
The owners of automatically created repositories can manage the access permissions by themselves.
The current permissions can be listed by:
ssh git@rtime.felk.cvut.cz perms -l «repo»
You can add permissions for either reading of writing the repo with:
ssh git@rtime.felk.cvut.cz perms «repo» + READERS «login» ssh git@rtime.felk.cvut.cz perms «repo» + WRITERS «login»
The permissions can be removed by replacing + with -.