Tutorials

Git HowTo

Git Access

To get access to a git repository on the git server “Schorsch”, you need to send a public ssh key to the system administrator, who will create the repository for you and will give you permission to access it via the ssh key.

A new public ssh key is generated with the ssh-keygen tool on the unix console. The generated RSA key is stored in ~/.ssh/id_rsa.pub. You need to rename this key to represent your personal identity. A good choice for the key file name is your valid email address plus the suffix .pub. For example:

 user.name@googlemail.com.pub

Then send this key file to the admin (along with the name of the repository)!

Do not send or rename the ~/.ssh/id_rsa key. This is your private key. It is required for your secure authentification. For that purpose it has to be kept secret!

Git Usage

Supposed the repository is named “repo”, then you can check out a local copy of the repository with the following command on the unix terminal:

 git clone ssh://git@schorsch.efi.fh-nuernberg.de:2200/repo

Now your can develop code by modifying that local copy.

For example, you can add a file to the local copy:

 git add filename

To commit all local modifications as a new check in.

 git commit -a

This commit is one additional step in the version history of your repository.

And to transmit all committed check-ins to the repo on the server:

 git push

To transmit all commited check-ins from the server that others have committed to your local copy:

 git pull

This may require a manual merge, if the versions have conflicts.

Happy coding!

Options: