GitLab

Since July 2016 we use [[https://gitlab.inf.unibz.it/|GitLab]] to collaborate.

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.

Here are some instructions on GitLab to ease its use.

If you need support on old repositories created via SVN please [[auth:repository_server|continue reading here]].

Initial setup

Git is usually preinstalled in Linux and Mac, while in Windows you have to [[https://git-scm.com/download/gui/windows | install a client]].

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.

The steps for pushing and pulling via SSH Key

Identify or create the 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]].

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). Once you click Add Key, you will see the it listed.

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:

git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@unibz.it"
git config --list

This data is stored in your gitconfiguration file: Linux/Mac: ~/.gitconfig Windows: C:\Users\username\.gitconfig

The content should be:

[user]
        name = Lastname Firstname
        email = your_email@unibz.it

Add your server data and insert this data in your ssh configuration file.

Linux/Mac file ~/.ssh/config:

host gitlab.inf.unibz.it
     user your_username

Windows file ~/.ssh/config:

Host gitlab.inf.unibz.it
RSAAuthentication yes
IdentityFile ~/.ssh/config/id_rsa.pub

Local Configuration

You have to run the commands inside the directory where you want your repository to be. From terminal/command line, type:

cd repository_folder
git config user.name "Firstname Lastname"
git config user.email "your_other@email"

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 </code> and run commands again.

Basic Git

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.

Create a new project via the web interface

Create a new project via the web interface. https://gitlab.inf.unibz.it/projects/new

Send the checkout URL to other collaborators. You can copy/paste it from the project settings (as SSH or as HTTPS).

git clone git@gitlab.inf.unibz.it:firstname-lastname/my-first-project.git
cd my-first-project
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
cd existing_folder
git init
git remote add origin git@gitlab.inf.unibz.it:firstname-lastname/my-first-project.git
git add .
git commit
git push -u origin master
git checkout master
git pull REMOTE NAME-OF-BRANCH -u

“”

git checkout -b NAME-OF-BRANCH
git checkout NAME-OF-BRANCH
git status

“”

git add CHANGES IN RED
git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"
git push REMOTE NAME-OF-BRANCH
git checkout .
git clean -f
git checkout NAME-OF-BRANCH
git merge master
  • Delete entry in keychain for gitlab.inf.unibz.it
  • Add key again to ssh client : ssh-add -K <key_path>
root@gitlab:~# vi /etc/cron.monthly/renew-le-certs
# 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
/var/www/wiki.inf.unibz.it/data/pages/auth/gitlab.txt · Last modified: 2021/07/05 18:09 by kohofer
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0