GIT/SSH Setup
If you’re taking part in a course at IAIK you have to upload an ssh public key to https://keyman.teaching.student.iaik.tugraz.at in order to get access to your remote account. If you don’t have a ssh-keypair yet, or want to create a new one for use with your repository use (we assume you want to name your key scs
, feel free to find a better name):
ssh-keygen -t rsa -b 4096 -f ~/.ssh/scs
Please ensure the private key has file access modes 600
(change with chmod 600
).
And enter some passphrase (an empty passphrase is not recommended). You will then have the files scs
and scs.pub
in the .ssh-directory in your home directory. The public key is the one with the extension .pub
.
Now we will inform our ssh-agent about the new key:
ssh-add ~/.ssh/scs
In addition to that, you have to tell ssh, that it should use this particular key for the remote machine, by editing ~/.ssh/config
and adding:
Host teaching.student.iaik.tugraz.at User git HostName teaching.student.iaik.tugraz.at IdentityFile ~/.ssh/scs
Important: If the file ~/.ssh/config
does not exist, create it first.
After you have uploaded the public key and set up your ~/.ssh/config
, you can start using git.
Then run the following command to clone your repository:
git clone git@teaching.student.iaik.tugraz.at:REPOSITORY_NAME.git .
Submit your work with
git commit # commit everything git tag ex1 # tag as ex1 for instance git push # push the commit git push --tags # make sure the tag is pushed
How to update a tag?
If you need to resubmit, remove the existing tag using the following commands:
git tag -d mytag git push origin :refs/tags/mytag
Then tag your new submission as before!
Using more than one IAIK git repository
For Side-Channel Security, you are only required to use one repository.
However, if you have to use more than one IAIK git repository, you can first try to upload your key to all of your repositories. If you can access all of your repositories you’re fine.
Otherwise, you have to generate a second SSH key (one for each repository) to access all of your repositories.
To use the different keys in the respective repositories you have to upload them and edit/create the file ~/.ssh/config
. Add the following lines:
Host iaik1 User git HostName teaching.student.iaik.tugraz.at IdentityFile ~/.ssh/iaik1 Host iaik2 User git HostName teaching.student.iaik.tugraz.at IdentityFile ~/.ssh/iaik2
You will now be able to clone your repositories using:
git clone git@iaik1:REPO1.git git clone git@iaik2:REPO2.git
Why do you always advertise zsh?
Because working with git without a proper shell and a proper configuration for your shell is a pain.
Avoid that. Enter:
sudo apt-get install zsh && wget -O ~/.zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc && chsh -s /usr/bin/zsh
Depending on the terminal application you use you might have to go to Profile Preferences and check the field run a custom command instead of my shell and the custom command is: /usr/bin/zsh
.