Getting Started with GITLAB
1. Install Git
The easiest way to install Git on Linux is, using the preferred package manager of your Linux distribution
yum install git-core
sudo apt-get install git-core
2. First-Time Git Setup
The first thing you should do when you install Git is to set your username and e-mail address. This is important because every Git commit uses this information, and it's immmutably baked into the commits you pass around.
git config --global user.name "Full User Name" git config --global user.email "email@example.com"
- Checking your Settings
git config --list
- Getting Help
git help <verb> git <verb> --help man git-<verb> git help config # manpage help for the config command
- Ignoring Files
Often, we have a class of files that we don't want Git to automatically add or even show us being untracked. These are generally automatically generated files such as files produced by the build system. In such cases, create a file named .gitignore listing patterns to match them.
File : .gitignore # Comment - this is ignored *.o # no .o files *.obj # no .obj files *.a # no .a files !*lib.a # but do track lib.a, even though we are ignoring .a files
Setting up .gitignore file before you get going is generally a good idea so yo don't accidentally commit files that you really don't want in your Git repository.
3. Generating SSH key
To generate a new SSH key just open your terminal and type the following command
ssh-keygen -t rsa -C "firstname.lastname@example.org" # Creates a new ssh key using the provided email
4. Logon to GITLAB Server
GITLAB is available on IP Address - 10.114.15.15. In the Web-Browser Address bar type:
Provide User Name and Password as:
USER Name = DESE domain e-mail address # email@example.com Password = DESE domain password
and click on the LDAP Sign in Button
5. Add SSH key to GitLab SSH Keys
This is necessary to work on your computer (laptop/workstation) and do the push, pull, etc to git Server(GITLAB). SSH key allows you to establish a secure connection between your computer and GITLAB.
Once you have logged in successfully, Select My Profile from the Dashboard as shown in the Fig.
A User Profile Window is presented, In this window, Click on Add Public Key Button.
Next, copy the contents of ~/.ssh/id_rsa.pub (public key) and paste it in the Key text box. Now Click on the Save button as shown in Fig.
6. Create Project on the git Server
It is necessary to create a project of the same name on the GITLAB before you do any push, pull operation from your computer.
If You have not logged on to GITLAB (10.114.15.15), logon to it using DESE domain e-mail and password using LDAP Sign In. In the Dashboard click on the Projects. In the Project Window, Click on the + New Project button as shown in the Fig.
In the New Project Window, type the Project Name and click on the Create Project button.
7. Create Project On your computer
Now, On your laptop/workstation, create a project (folder) of the same name what you have created on the GITLAB, and track it using git(GITLAB).
mkdir simple cd simple git init touch README git add README git commit -m 'first commit' git remote add origin firstname.lastname@example.org:usrname/simple.git git push -u origin master
8. Existing Project?
Create a project of the same name as existing project on the GITLAB as explained in step 6. Then
cd existing_project git init git add . git remote add origin email@example.com:username/existing_project.git git push -u origin master