-
Notifications
You must be signed in to change notification settings - Fork 8
Generating SSH keys
This manual is largely based on the Generating SSH keys Github page.
For the course you will need to work with Git. To identify you with the Git server, you should set up an SSH key.The steps below will walk you through generating an SSH key and adding the public key to your DevHub account.
You will need to install Git. Follow the steps below for your operating system. You are allowed to use other Git clients for the labwork, but we will not help you to set up Git for these clients.
Please install Git Bash. If you want to use Powershell instead of Mingw, it is recommended to install with the Powershell extensions enabled, so the commands used in this manual will work on your terminal.
Git is included in the XCode Command Line Tools. Open a terminal and run git to see if Git is installed. If not, the system will prompt you to install Git.
Open a terminal and install Git using the package manager of your preference, for example: apt-get install git.
Open a terminal (we highly recommmend Git Bash for windows) and run the following command:
ls -l ~/.sshIf you get an error: No such file or directory continue with the steps
If the directory contains a file named id_rsa.pub you do not have to set up a new SSH key and you can go to step 3.
Open a terminal and run the following commands:
ssh-keygen -t rsa -C "<your_name>@student.tudelft.nl"And press "Enter" 3 times, as we want to use the standard name without a password
eval `ssh-agent -s` # Windows (Git Bash) (make sure you use ` characters)
eval $(ssh-agent -s) # Linux, Mac or Windows with (msysgit)ssh-add ~/.ssh/id_rsaIf you get the error "Could not open a connection to your authentication agent", you a have to enable it. (See above)
Copy the file contents of the public key to the clipboard:
clip < ~/.ssh/id_rsa.pub # Windows
pbcopy < ~/.ssh/id_rsa.pub # OSX
sudo apt-get install xclip && xclip -sel clip < ~/.ssh/id_rsa.pub # Linux- Login to Devhub and click go To Account.
- Click Setup new SSH key.
- Give the SSH key a name, for example: My Laptop
- Paste the key contents to the public SSH key field NOTE do not add spaces or new lines to the content*
- Click Add SSH key
Now that you have Git on your system, you’ll want to do a few things to customize your Git environment. The first thing you should do when you install Git is to set your user name and e-mail address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating.
git config --global user.name "<your name>"
git config --global user.email <your_name>@student.tudelft.nl- Go to Courses and click the current course
- Copy the Git clone url from the page and execute it in the terminal. It will look something like this:
git clone ssh://[email protected]/courses/ti1706/1617/group-<Your group number> - If you get a connection time out, you probably did one or more of the steps above wrong.
- If it asks you for a password, you probably did one or more of the steps above wrong.
- WARNING: If you try to clone incorrectly more than 5 times, you will be blocked for an hour
- Click Clone / New in SourceTree
- Click Add Working Copy and add the repository via ...
- Click Options under the Tools tab (Top bar) in SourceTree
- Under SSH Client Configurations the SSH Client is probably: PuTTY / Plink. Change this to OpenSSH (This step is not needed on mac)
- The field above should probably have changed to the correct rsa key. If you decided to change the name of the rsa key, you should change it to the correct key.
- Good luck!
- Open Git Bash
- Run the following command:
printf "eval \`ssh-agent -s\`\nssh-add ~/.ssh/id_rsa" >> ~/.bashrc