User Tools

Site Tools


auth_gitlab

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
Next revisionBoth sides next revision
auth_gitlab [2019/12/03 14:44] – [Check for an existing SSH key] apanoauth_gitlab [2019/12/03 15:08] – [Configure your local Git Client] apano
Line 45: Line 45:
 You can check your e-mail on your Gitlab Profile -> Main Settings -> Email You can check your e-mail on your Gitlab Profile -> Main Settings -> Email
  
-When you are asked for a location and file name you can either keep the default location or choose a new one. If this is your only key we advice you accept the defaults and maintain the file name id_rsa. Should you have several keys you can name them according to your own choice. [[https://docs.gitlab.com/ee/ssh/README.html|GitLab Official Documentation]] +When you are asked for a location and file name you can either keep the default location or choose a new one. If this is your only key we advice you accept the defaults and maintain the file name id_rsa. Should you have several keys you can name them according to your own preferences. [[https://docs.gitlab.com/ee/ssh/README.html|GitLab Official Documentation]] 
  
-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.+Add the key to your ssh agent by issuing this commands on Linux/macOS or Git Bash for Windows (adapt to your id_rsa path):  
 + 
 +<code> 
 +$ eval "$(ssh-agent -s)" 
 +$ ssh-add -K ~/.ssh/id_rsa 
 +</code> 
 + 
 +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.
  
 ===== Add an SSH key ===== ===== Add an SSH key =====
-If you already have an SSH key login to GitLab and go to → Profile Settings → SSH Keys. In the field Key copy the contents of the file: id_rsa.pub (or any other file containing your key).  +Login to Gitlab and go in your profile → Main Settings → SSH Keys.  
-Once you click Add Key, you will see the it listed.+ 
 +In the field Key copy the contents of the file: id_rsa.pub (or any other file containing your key).  
 + 
 +Choose a name to identify the key (ex. YourComputerName) and click Add Key, you will see the it listed.
  
 ===== Configure your local Git Client ===== ===== Configure your local Git Client =====
  
 Before proceeding check if your GIT client is already configured.  Before proceeding check if your GIT client is already configured. 
-LINUX/MACOSX terminal or Windows GIT bash , type the following: <code>git config --global --list</code> <code> git config --list </code>+In Linux/macOS terminal or Windows Git Bash, type the following: <code> git config --global --list</code> <code> git config --list </code>
  
-If you use only one server for Git repositories configure it globally, otherwise locally +This command lists any existing GIT repositories configurations.  
- +If you have an already existing configuration choose a local configuration (folder specific) for GIT. If you have no other GIT configurations you can configure it globally. 
-==== Global GIT configuration ==== +==== Global configuration ==== 
-To configure GIT globally using the SSH key Inside the terminal/command line, type:+To configure GIT globally using the SSH key inside the terminal/command line, type:
 <code> <code>
 git config --global user.name "Firstname Lastname" git config --global user.name "Firstname Lastname"
Line 69: Line 79:
  
 This data is stored in your gitconfiguration file:  This data is stored in your gitconfiguration file: 
-Linux/Mac: ~/.gitconfig+ 
 +Linux/macOS: ~/.gitconfig 
 Windows: C:\Users\username\.gitconfig Windows: C:\Users\username\.gitconfig
  
Line 76: Line 88:
 [user] [user]
         name = Lastname Firstname         name = Lastname Firstname
-        email = your_email@unibz.it+        email = your@email
 </code> </code>
  
-Add your server data and insert this data in your ssh configuration file. +Add your server data in your ssh configuration file. Verify the path is correct
  
 Linux/Mac file ~/.ssh/config: Linux/Mac file ~/.ssh/config:
 <code> <code>
 host gitlab.inf.unibz.it host gitlab.inf.unibz.it
 +     HostName gitlab.inf.unibz.it
      user your_username      user your_username
 +     IdentityFile ~/.ssh/id_rsa.pub
 </code> </code>
  
Line 90: Line 104:
 <code> <code>
 Host gitlab.inf.unibz.it Host gitlab.inf.unibz.it
-RSAAuthentication yes +     RSAAuthentication yes 
-IdentityFile ~/.ssh/config/id_rsa.pub+     IdentityFile ~/.ssh/config/id_rsa.pub
 </code> </code>
  
Line 98: Line 112:
  
 <code txt> <code txt>
-cd repository_folder+cd repository_folder_in_your_computer
 git config user.name "Firstname Lastname" git config user.name "Firstname Lastname"
-git config user.email "your_other@email"+git config user.email "your@email"
 </code> </code>
  
 Should you receive this message  **fatal: not in a git directory**, you have to initialize the folder as a git folder. Issue command : <code> Should you receive this message  **fatal: not in a git directory**, you have to initialize the folder as a git folder. Issue command : <code>
 git init git init
-</code> and run commands again.  +</code> and run git commands again.  
  
 ===== Basic Git ===== ===== Basic Git =====
/data/www/wiki.inf.unibz.it/data/pages/auth_gitlab.txt · Last modified: 2020/04/02 11:25 by apano