auth:howto:sshkeygitlab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
auth:howto:sshkeygitlab [2016/06/07 17:37] – [LOCAL GITLAB PROFILE] apano | auth:howto:sshkeygitlab [2019/12/03 14:07] – [GET/SET SSH KEY] apano | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== GET/SET SSH KEY ===== | ===== GET/SET SSH KEY ===== | ||
- | You need an SSH key that resides on your workstation/ | + | You need an SSH key that resides on your workstation/ |
+ | |||
+ | To check if you already have an SSH key you have to check the file: | ||
- | To check if you already have an SSH certificate that you have to check the file: | ||
LINUX/ | LINUX/ | ||
WINDOWS < | WINDOWS < | ||
- | If this file contains an SSH-RSA key, you can proceed to step 2. | + | If this file contains an SSH-RSA key (open the file with a text editor), proceed to [[https:// |
- | If this file is empty or does not exist, | + | |
- | To generate | + | If this file is empty or does not exist, it means that the key was never generated so you have to generate it. |
- | To generate | + | |
- | < | + | |
- | To generate the key via PuTTygen follow the guidelines of the product. | + | |
- | Remember that you can also use another name for the file name. You can call the file gitlab_rsa if you prefer or anything else. | + | To generate an SSH key via command line open a LINUX/ |
+ | < | ||
+ | |||
+ | |||
+ | When you're asked to "Enter a file in which to save the key," select either the default location or a location you prefer and leave as name id_rsa (if this is your only RSA key) or setup a file name of your choice.[[https:// | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | You can also use a key generator such as [[http:// | ||
===== CONFIGURE GITLAB ONLINE ===== | ===== CONFIGURE GITLAB ONLINE ===== | ||
- | Login to GitLab and go to -> Profile Settings -> SSH Keys. In the field Key copy the contents of the file: id_rsa.pub generated in step 1. | + | Login to GitLab and go to -> Profile Settings -> SSH Keys. |
- | Once you click Add Key, you will see the key listed in your SSH Keys. | + | |
- | ===== LOCAL GITLAB PROFILE ===== | + | In the field Key copy all the contents of the file: id_rsa.pub (or the specific name of your RSA key) |
+ | Click Add Key. | ||
- | ==== SINGLE GIT ACCOUNT ==== | + | The key is listed in your SSH Keys. |
- | You have to configure your locally installed gitlab to connect using the ssh key. | + | |
- | LINUX/MACOSX | + | [[https:// |
- | git config --global user.name " | + | ===== GITLAB CLIENT CONFIGURATION ===== |
- | git config --global user.email " | + | |
- | git config --list | + | ==== GLOBAL GIT ACCOUNT ==== |
+ | You have to configure your locally installed gitlab client to connect using the ssh key. | ||
+ | |||
+ | Inside a terminal | ||
- | WINDOWS | + | < |
- | Inside your GIT bash command line, type the following: | + | |
git config --global user.name " | git config --global user.name " | ||
git config --global user.email " | git config --global user.email " | ||
git config --list | git config --list | ||
+ | </ | ||
The last command should show the data you entered and is your gitlab global configuration. | The last command should show the data you entered and is your gitlab global configuration. | ||
Line 52: | Line 59: | ||
Try to checkout repo. Should you experience trouble check the contents of file: .ssh/ | Try to checkout repo. Should you experience trouble check the contents of file: .ssh/ | ||
+ | < | ||
host gitlabhostname.unibz.it | host gitlabhostname.unibz.it | ||
+ | </ | ||
| | ||
- | ==== MULTIPLE | + | ==== LOCAL GIT ACCOUNT |
You can also have different gitlab accounts (with different RSA keys) for different hosts. You can keep a global user/email configuration and a local configuration for a specific repository. In the root of a repository, run: | You can also have different gitlab accounts (with different RSA keys) for different hosts. You can keep a global user/email configuration and a local configuration for a specific repository. In the root of a repository, run: | ||
<code txt> | <code txt> | ||
git config user.name " | git config user.name " | ||
- | git config | + | git config user.email " |
</ | </ | ||
/data/www/wiki.inf.unibz.it/data/pages/auth/howto/sshkeygitlab.txt · Last modified: 2019/12/03 14:18 by apano