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 NEVER 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!

We suggest to NOT use any passphrase with the key, as this would require you to enter it on every connection. Also, several tools don’t work with keys with passphrases.

On Windows 10 an ssh-key can be generated the same way when the “Linux Subsystem” is installed. On all Windows Systems, ssh-keys can also be generated with putty with the accompanying puttygen tool. Do not send the saved key, but rather copy the “Public key for pasting into authorized_keys file” from the dialog.

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: