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
auth:gitlab [2017/06/13 11:46] apanoauth:gitlab [2021/07/05 18:09] (current) kohofer
Line 5: Line 5:
 UNIBZ users have to login to [[https://gitlab.inf.unibz.it/|GitLab]] and their account will be automatically enabled.  UNIBZ users have to login to [[https://gitlab.inf.unibz.it/|GitLab]] and their account will be automatically enabled. 
  
-External users can sign up with their Google, Twitter, or Facebook account. The external user has to motivate the request by sending an e-mail to cs-tech@lists.inf.unibz.it+External users can sign up with their Google, Twitter, or Facebook account.
  
 Here are some instructions on GitLab to ease its use. Here are some instructions on GitLab to ease its use.
Line 12: Line 12:
  
 ===== Initial setup ===== ===== Initial setup =====
-Git is usually preinstalled in Linux and Mac, check the version <code> +Git is usually preinstalled in Linux and Mac, while in Windows you have to [[https://git-scm.com/download/gui/windows | install a client]].
-git --version</code>+
  
-You have to instruct Git to use a specific username/e-mail combination for gitlab.inf.unibz.it or any other hosts your need. Git allows you to have a global configuration or local configurations.  +You can have different hosts for different Git repositories which you access via specific username/e-mail. You have to configure your local Git with these settings
-To check if you have any configurations saved: <code>git config --global --list</code> +
-If your global configuration is empty then you can create a global configuration, unless create a local configuration for the repository you need+
  
 The steps for pushing and pulling via SSH Key The steps for pushing and pulling via SSH Key
  
-  * Step 1: [[https://docs.gitlab.com/ee/ssh/README.html|Identify or create SSH Key]]  +  * Step 1: [[auth:gitlab#identify_or_create_the_ssh_key|Identify or create SSH Key]] - [[https://docs.gitlab.com/ee/ssh/README.html|Official Documentation]]  
-  * Step 2: [[https://docs.gitlab.com/ee/gitlab-basics/create-your-ssh-keys.html|Add SSH Key]] +  * Step 2: [[auth:gitlab#add_an_ssh_key|Add SSH Key]] - [[https://docs.gitlab.com/ee/gitlab-basics/create-your-ssh-keys.html|Official Documentation]] 
-  * Step 3: Configure your local client (global/local configuration)+  * Step 3: [[auth:gitlab#configure_your_local_git_client| Configure your local Git client]]
  
-==== Global GIT configuration ==== +===== Identify or create the SSH key ===== 
-Check if your GIT client is already configured:   +If you need support on how to generate the SSH key follow our guide on [[auth:howto:sshkeygitlab|How to add an SSH Key for GITLAB]]. 
-LINUX/MACOSX Inside a terminal or in Windows inside your GIT bash command line , type the following+
  
-<code> +===== Add an SSH key ===== 
-git config --list +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).  
-</code>+Once you click Add Key, you will see the it listed.
  
-If there is no account/content, configure GIT globally. Inside the terminal/command line, type:+===== Configure your local Git Client ===== 
 + 
 +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> 
 + 
 +If you use only one server for Git repositories configure it globally, otherwise locally 
 + 
 +==== Global GIT configuration ==== 
 +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 40: Line 44:
 </code> </code>
  
-The last command should show the data you entered and is your gitlab global configuration.  +This data is stored in your gitconfiguration file:  
-This data is saved in the file ~/.gitconfig: +Linux/Mac: ~/.gitconfig 
 +WindowsC:\Users\username\.gitconfig
  
 +The content should be: 
 <code txt> <code txt>
 [user] [user]
Line 49: Line 55:
 </code> </code>
  
-Try to checkout repoShould you experience trouble check the contents of file.ssh/config. You can manually insert+Add your server data and insert this data in your ssh configuration file 
 + 
 +Linux/Mac file ~/.ssh/config:
 <code> <code>
 host gitlab.inf.unibz.it host gitlab.inf.unibz.it
      user your_username      user your_username
 +</code>
 +
 +Windows file ~/.ssh/config: 
 +<code>
 +Host gitlab.inf.unibz.it
 +RSAAuthentication yes
 +IdentityFile ~/.ssh/config/id_rsa.pub
 </code> </code>
  
 ==== Local Configuration ==== ==== Local Configuration ====
-You have to do it in the root of the repository. From terminal/command line, type:+You have to run the commands inside the directory where you want your repository to be. From terminal/command line, type:
  
 <code txt> <code txt>
Line 66: Line 81:
 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 then configure again the user.name and user.email parameters.  +</code> and run commands again.  
-==== Add an SSH key ==== +
-If you need support on how to generate the SSH key follow our guide on [[auth:howto:sshkeygitlab|How to add an SSH Key for GITLAB]]+
  
-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).  +===== Basic Git =====
-Once you click Add Key, you will see the key listed in your SSH Keys. +
-===== Basic Git commands =====+
 The logic of git requires you to checkout a project via CLONE. You ensure the project files are up to date by issuing a PULL command. Once the modifications on the project are done, you ADD the changes, you COMMIT them and you PUSH them to the gitlab server. The logic of git requires you to checkout a project via CLONE. You ensure the project files are up to date by issuing a PULL command. Once the modifications on the project are done, you ADD the changes, you COMMIT them and you PUSH them to the gitlab server.
  
Line 173: Line 184:
  
  
 +===== Some support cases =====
 +SourceTree failing to connect
  
 +  * Delete entry in keychain for gitlab.inf.unibz.it
 +  * Add key again to ssh client : ssh-add -K <key_path>
  
 +
 +===== Renew the SSL certificates - gitlab.inf.unibz.it =====
 +
 +Certificate is valid for 3 months
 +
 +A cronjob renews the certificate every 1st day of the month
 +
 +  root@gitlab:~# vi /etc/cron.monthly/renew-le-certs
 +
 +<code>
 +# At 04:05 on day-of-month 1.
 +5 4 1 * *       /opt/gitlab/bin/gitlab-ctl renew-le-certs
 +# At 04:10 on day-of-month 1.
 +10 4 1 * *      /opt/gitlab/bin/gitlab-ctl reconfigure
 +</code>
  
  
  
  
/data/www/wiki.inf.unibz.it/data/attic/auth/gitlab.1497347210.txt.gz · Last modified: 2019/01/16 10:03 (external edit)