User Tools

Site Tools


auth:howto:sshkeygitlab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
auth:howto:sshkeygitlab [2017/06/13 11:56] – [LOCAL GITLAB CLIENT PROFILE] apanoauth:howto:sshkeygitlab [2019/12/03 14:18] (current) – [GET/SET SSH KEY] apano
Line 6: Line 6:
 You need an SSH key that resides on your workstation/notebook. You can use an already existing key or generate a new one.  You need an SSH key that resides on your workstation/notebook. You can use an already existing key or generate a new one. 
  
-To check if you already have an SSH certificate that you have to check the file: +To check if you already have an SSH key you have to check the file: 
 LINUX/MACOSX <code>.ssh/id_rsa.pub </code>  LINUX/MACOSX <code>.ssh/id_rsa.pub </code> 
 WINDOWS <code>%userprofile%\.ssh\id_rsa.pub</code> WINDOWS <code>%userprofile%\.ssh\id_rsa.pub</code>
  
-If this file contains an SSH-RSA key, proceed to [[https://wiki.inf.unibz.it/auth/howto/sshkeygitlab#configure_gitlab_online| Configure the SSH key on gitlab.inf.unibz.it]]+If this file contains an SSH-RSA key (open the file with a text editor), proceed to [[https://wiki.inf.unibz.it/auth/howto/sshkeygitlab#configure_gitlab_online| Configure the SSH key on gitlab.inf.unibz.it]].
-If this file is empty or does not exist, it means that the key was never generated+
  
-To generate the key you can use a key generator such as [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|PuTTYgen]], or command line.  +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 the key via command line use the command: +
-<code>ssh-keygen -t rsa -C "your_email@unibz.it" -b 4096</code> +
-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.inf_rsa if you prefer or anything else +To generate an SSH key via command line open a LINUX/MACOSX terminal or WINDOWS Git BASH and run the command: 
-[[https://docs.gitlab.com/ee/ssh/README.html|GitLab Official Documentation]]+<code>ssh-keygen -t rsa -C "your@email" -b 4096</code> 
 + 
 + 
 +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://docs.gitlab.com/ee/ssh/README.html|GitLab Official Documentation]]   
 + 
 +<note important>Windows Git Bash your rsa-key (~/.ssh/id_rsa) file MUST be called id_rsa.</note> 
 + 
 +You can also use a key generator such as [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|PuTTYgen]] instead of using the terminal. Please refer to the guidelines of the product on how to create the RSA key and the location of the file.  
  
 ===== CONFIGURE GITLAB ONLINE ===== ===== CONFIGURE GITLAB ONLINE =====
-Login to GitLab and go to -> Profile Settings -> SSH Keys.+Login to GitLab and go to your profile -> Settings -> SSH Keys. 
 + 
 +{{:auth:howto:gitlab-profile-settings.png?200|}} 
 + 
 +In the field Key copy all the contents of the file: id_rsa.pub (or the specific name of your RSA key)
  
 +Choose a name to identify the key (ex. YourComputerName)
  
-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.  Click Add Key. 
  
Line 36: Line 44:
 You have to configure your locally installed gitlab client to connect using the ssh key.  You have to configure your locally installed gitlab client to connect using the ssh key. 
  
-Inside a terminal (Linux, MacOS)/GIT bash (Windows), type the following: +Inside a terminal (Linux, MacOS)/Git BASH (Windows), type the following: 
  
 <code> <code>
 git config --global user.name "Firstname Lastname" git config --global user.name "Firstname Lastname"
-git config --global user.email "your_email@unibz.it"+git config --global user.email "your@email"
 git config --list git config --list
 </code> </code>
Line 51: Line 59:
 [user] [user]
         name = Lastname Firstname         name = Lastname Firstname
-        email = your_email@unibz.it+        email = your@email
 </code> </code>
  
Line 62: Line 70:
                  
 ==== LOCAL GIT ACCOUNT ==== ==== 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 git 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>
/data/www/wiki.inf.unibz.it/data/attic/auth/howto/sshkeygitlab.1497347805.txt.gz · Last modified: 2019/01/16 10:03 (external edit)