Git repository on this server: Difference between revisions
| Line 49: | Line 49: | ||
If you do not have write access to the repository of some project (e.g. central repository on this server), you can work in your personal repository then ask somebody with write access to merge your changes. | If you do not have write access to the repository of some project (e.g. central repository on this server), you can work in your personal repository then ask somebody with write access to merge your changes. | ||
# Clone a central repository <pre>git clone git://rtime.felk.cvut.cz/project.git</pre> | |||
Edit files in project... | # Edit files in project... | ||
# Commit your changes <pre>git commit ...</pre> | |||
# Add your rtime personal repository as remote (using SSH access) <pre>git remote add personal yourlogin@rtime.felk.cvut.cz:myproject.git</pre> | |||
# Push your changes to your personal repository <pre>git push personal</pre> | |||
Write email to somebody with write access merge changes in <tt>git://rtime.felk.cvut.cz/~''yourlogin''/''myproject''.git</tt> | # Write email to somebody with write access merge changes in <tt>git://rtime.felk.cvut.cz/~''yourlogin''/''myproject''.git</tt> | ||
Revision as of 14:40, 15 February 2009
This server can host two types of Git repositories.
- Central repositories
- These repositories are located under /var/git directory and can be browsed online. Only server administrators can create and controll access to central repositories. Central repositories are usually public (read-only accessible to everybody).
- Personal repositories
- Any user with shell access can can create his/her own git repository under his/her home directory and make it public using git protocol.
Creating a personal repository
ssh login@rtime.felk.cvut.cz mkdir $HOME/myproject.git cd $HOME/myproject.git git init --bare --shared=everybody
If you want to make your repository public, it has to be accessible by user nobody. It is usually sufficient to give "x" permission to your home directory:
setfacl -m user:nobody:x $HOME
First push (upload)
After an empty repository is created either by you (personal) of by an admin (central), you can push (upload) data to it:
- Optional: Setup passwordless login to the server
- Optional for central repositories: Fill in the description of the project for GitWeb interface – edit the file /var/git/repo-name.git/description on the server.
- Install Git on your local computer
- Put your sources into your local repository
cd your/project git init # initializes git repository in your project's directory git add . # tells git to track all files in your project git commit # commits the added files to the repository
- Then "connect" your repository to the one on this server (replace login by your login and repo-name by the name of repository created for you)
git remote add origin login@rtime.felk.cvut.cz:/var/git/repo-name.git git config branch.master.remote origin git config branch.master.merge refs/heads/master
- Push your sources to the server
git push --all
How can other people access your repository
Once the repository is not empty, everybody can use one of following commands to work with the code in the repository (it is not necessary add origin and configure remote branches as described above):
Central repository
git clone login@rtime.felk.cvut.cz:/var/git/repo-name.git git clone git://rtime.felk.cvut.cz/repo-name.git
Personal repository
git clone git://rtime.felk.cvut.cz/~yourlogin/repo-name.git
For other hints refer to the git documentation or to this page.
Using personal repository to contribute to other projects
If you do not have write access to the repository of some project (e.g. central repository on this server), you can work in your personal repository then ask somebody with write access to merge your changes.
- Clone a central repository
git clone git://rtime.felk.cvut.cz/project.git
- Edit files in project...
- Commit your changes
git commit ...
- Add your rtime personal repository as remote (using SSH access)
git remote add personal yourlogin@rtime.felk.cvut.cz:myproject.git
- Push your changes to your personal repository
git push personal
- Write email to somebody with write access merge changes in git://rtime.felk.cvut.cz/~yourlogin/myproject.git