CoEPP GitLab
Introduction
Login
Non CoEPP users can also have access to the tool but their account has to be explicitly created by the GitLab administrator. If an external CoEPP user needs access to the tool, please send a request to
rc@coepp.org.au with the following information:
First and last names.
Institution.
Preferred login name.
Institutional email.
Starting with GitLab
General Dashboard
Profile customization
Project Creation
$ git config --global user.name "Goncalo Borges"
$ git config --global user.email "goncalo@XXXXX"
$ mkdir myfirstproject; cd myfirstproject
$ git init
Initialized empty Git repository in /suphys/goncalo/GITLABTUTORIAL/myfirstproject/.git/
$ echo "This is my first project in GITLAB" > README.md
$ git add README.md
$ git commit -m "first commit"
[master (root-commit) 3e33a5f] first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 README.md
$ git remote add origin git@gitlab.coepp.org.au:goncalo/myfirstproject.git
$ git push -u origin master
The authenticity of host 'gitlab.coepp.org.au (144.6.225.162)' can't be established.
RSA key fingerprint is 18:7a:15:cd:00:c2:50:c8:f9:a7:9f:07:97:ba:b8:38.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.coepp.org.au,144.6.225.162' (RSA) to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 254 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@gitlab.coepp.org.au:goncalo/myfirstproject.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
Project Commits
$ git pull
Already up-to-date.
$ vi prime.py
$ git add prime.py
$ git commit -m "second commit"
[master 8a96740] second commit
1 files changed, 20 insertions(+), 0 deletions(-)
create mode 100644 prime.py
$ git push
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 553 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@gitlab.coepp.org.au:goncalo/myfirstproject.git
3e33a5f..8a96740 master -> master
Project Browse
Project Settings
Project
Allows project owner to change Project Visibility, Default Branch or which GitLab functionalities (Issues, Merge Requests, Wiki and Snippets) should be enabled for the project.
Members
Users can be added with different roles:
Guest,
Reporter,
Developer and
Master. The definition of the permissions attributed to each role are defined here:
GitLab User/Role permissions.
Web Hooks
Allows the owner to define the execution of actions or scripts, accessible via a predefined
URL, and triggered by specific GitLab events such as
Push, Tah push, Merge Requests and Issues.
Protected branches
Project Groups
When you create a new project in GitLab, the default namespace for the project is the personal namespace associated with your GitLab user. When you transfer or create a project within a group, the name space changes. Group project URLs are prefixed with the group namespace.
$ git clone git@gitlab.coepp.org.au:my-first-group/myfirstproject.git
The advantage of groups is that you can automatically set user roles / permissions to all projects belonging to the same group. If you need a more fine grained permission setting as a function of project, you should tune it in the project configuration. Therefore, members of a group may only view projects they have permission to access.
SVN to GIT Migration
Introduction
GitLab provides a browsable placeholder for several git projects.
However, it may well happen that users already have their data is other kind of repositories, like SVN.
It is then necessary to migrate the data from a SVN repo to a git project.
The instructions on how to migrate a single SVN repository to a git project will follow.
Instructions
$ svn log -q file:////import/sydpp1/svnsydpp/atlas/CommonArea/SUSY/SUSY_ToolsSel | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
# Original file
$ cat authors-transform.txt
saavedra = saavedra <saavedra>
swasnik = swasnik <swasnik>
# Changed file
$ cat authors-transform.txt
saavedra = saavedra <saavedra@physics.usyd.edu.au>
swasnik = swasnik <swasnik@physics.usyd.edu.au>
# For a well defined trunk
$ git svn clone file:////import/sydpp1/svnsydpp/atlas/CommonArea/SUSY/SUSY_ToolsSel --no-metadata -A authors-transform.txt --stdlayout ~/temp
or
# If you do not have a trunk definition in your SVN repo
$ git svn clone file:////import/sydpp1/svnsydpp/atlas/CommonArea/SUSY --no-metadata -A authors-transform.txt --trunk=SUSY_ToolsSel ~/temp
$ git init --bare ~/SUSY_ToolsSel.git
$ cd ~/SUSY_ToolsSel.git
$ git symbolic-ref HEAD refs/heads/trunk
$ cd ~/temp
$ git remote add bare ~/SUSY_ToolsSel.git
$ git config remote.bare.push 'refs/remotes/*:refs/heads/*'
$ git push bare
$ cd ..
$ rm -Rf temp
$ cd ~/SUSY_ToolsSel.git
$ git branch -m trunk master
$ git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4 | while read ref; do git tag "$ref" "refs/heads/tags/$ref"; git branch -D "tags/$ref"; done
$ cd ..; git clone ~/SUSY_ToolsSel.git SUSY_ToolsSel_clone
$ ll SUSY_ToolsSel_clone
total 8
drwxr-xr-x 2 goncalo people 4096 Apr 21 01:28 grid
drwxr-xr-x 2 goncalo people 75 Apr 21 01:28 localbatch
drwxr-xr-x 10 goncalo people 4096 Apr 21 01:28 python
$ cd SUSY_ToolsSel_clone
$ git remote rm origin
$ git remote add origin git@gitlab.coepp.org.au:goncalo/SUSY_ToolsSel.git
$ git push -u origin master
$ git push --all
$ git push --tags