|
|
|
## SSH Keys
|
|
|
|
|
|
|
|
Secure SHell (SSH) is a protocol to enable secure communication over an unsecured network. SSH keys are cryptographic keys that can be used to manage access to network resources. In the Mathews lab, we use them to access the GitLab server over SSH as well as to enable password-less logins over the network. One of the first things new users should do is to generate SSH keys.
|
|
|
|
|
|
|
|
### Generate SSH Keys
|
|
|
|
```Bash
|
|
|
|
ssh-keygen -t rsa -b 4096
|
|
|
|
Generating public/private rsa key pair.
|
|
|
|
Enter file in which to save the key (/home/username/.ssh/id_rsa):
|
|
|
|
```
|
|
|
|
|
|
|
|
At this point press ENTER to save the keys to the default location.
|
|
|
|
|
|
|
|
### Add your SSH keys to your GitLab account
|
|
|
|
|
|
|
|
To add your SSH key to your GitLab account, first log into your GitLab account.
|
|
|
|
|
|
|
|
![Settings1](Images/QuickStart/GitLab-Settings1.png)
|
|
|
|
|
|
|
|
Then open your account settings page.
|
|
|
|
|
|
|
|
![Settings2](Images/QuickStart/GitLab-Settings2.2.png)
|
|
|
|
|
|
|
|
Open the page for SSH keys.
|
|
|
|
|
|
|
|
![SSH_Key](Images/QuickStart/GitLab-SSH_Key.png)
|
|
|
|
|
|
|
|
Copy the contents of the file `/home/username/.ssh/id_rsa.pub` into the field on the web page and give the key a name.
|
|
|
|
|
|
|
|
## Git
|
|
|
|
|
|
|
|
Git is a distributed version control system that facilitates collaborative software development.
|
|
|
|
|
|
|
|
## Git setup
|
|
|
|
Check and see if git is installed.
|
|
|
|
|
|
|
|
```Bash
|
|
|
|
git --version
|
|
|
|
```
|
|
|
|
|
|
|
|
If the software is not present, it can be installed from your distribution's software repositories. For example, for Ubuntu/Debian-based systems, git can be installed with the following command.
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo apt-get install git
|
|
|
|
```
|
|
|
|
|
|
|
|
In order to commit changes to a git repository, you first need to identify yourself.
|
|
|
|
|
|
|
|
```Bash
|
|
|
|
git config --global user.name "{Your Name}"
|
|
|
|
git config --global user.email "{Your email}"
|
|
|
|
```
|
|
|
|
|
|
|
|
This step allows git to establish who made any specific change to the repository.
|
|
|
|
|
|
|
|
An optional step is to define your default text editor.
|
|
|
|
```Bash
|
|
|
|
git config --global core.editor emacs
|
|
|
|
``` |
|
|
|
\ No newline at end of file |