How do I set up git over ssh so I can clone my repository from git.cs.vt.edu onto an rlogin machine?
As practiced in ex0
you should use ssh authentication when accessing your git repository.
To that end:
-
make a new key pair. For instance, run
ssh-keygen
on rlogin. Save the private key not in~/.ssh/id_rsa
or similar, save it in say~/.ssh/keyforgit
-
the public key would then be in
~/.ssh/keyforgit.pub
. If not, runssh-keygen -y -f ~/.ssh/keyforgit
to get it. -
copy and paste the public key into the page under Profile that says SSH Keys.
-
inform ssh that you want to use this key when establishing ssh connections to git.cs.vt.edu. You do this by adding the following entry to your
~/.ssh/config
Host git.cs.vt.edu
User git
AddressFamily inet
IdentityFile ~/.ssh/keyforgit
(the inet
restricts to IPv4 because our IPv6 sometimes doesn't work.)
- test by running
ssh -T git@git.cs.vt.edu
on rlogin. You should see:
$ ssh -T git@git.cs.vt.edu
Welcome to GitLab, @gback!
-
now you're ready to
git clone
, etc. -
Note that
~/.ssh
refers to the.ssh
subdirectory in your home directory on rlogin. Remember that this is a shared file system - you have the same home directory on every machine in the cluster, no matter where you happen to be logged in. -
Note that it's not strictly necessary to have different key pairs, but we recommend it. In theory, you could use the same key pair you use for logging into rlogin to access git.cs.vt.edu from rlogin by copying your private key into your
~/.ssh
directory under one of the common names (id_rsa
, etc.) that are automatically consulted by the ssh client.