How to Clone a Project in Gitlab-CE 12.0.3 on CentOS 7.6
How to clone the Project In Gitlab-CE 12.0.3 via SSH and HTTP On CentOS 7.6
Pre-requisite:
Git
Local Machine IP : 192.168.7.231
Remote Gitlab Server IP : 192.168.7.229
Basic Setup On Local machine :
Install git in order to clone the project
[root@LinuxHelp ~]# yum install git -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.viethosting.com
* epel: my.fedora.ipserverone.com
* extras: mirrors.viethosting.com
* updates: centos.myfahim.com
Resolving Dependencies
--> Running transaction check
.
.
.
.
Installed:
git.x86_64 0:1.8.3.1-20.el7
Dependency Installed:
perl-Git.noarch 0:1.8.3.1-20.el7
Complete!
SSH-Key generation process
Generate the ssh key using ssh-keygen using rsa algorithm as follows
[root@LinuxHelp ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:9OTtuEil8Hhcb7/RuHlf6d9IkBNwTqJMJPMCvntWkfE root@LinuxHelp
The key's randomart image is:
+---[RSA 2048]----+
| . o.+ o o |
| . . * = * |
| . . B E o |
| . o = . o |
| . . S = = |
| . * + + o o.|
| . + * . + +.o|
| o o . o o.=+|
| . . *+*|
+----[SHA256]-----+
Open the ssh public Key file and copy the Key
[root@LinuxHelp ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzqjAL7msZVJxtuew2//dVNPBVkZFahNePWtyX9y/p+YepiYAsCPDfKR40Y2XHvBqOF+xaltfKz8h702M4np3QXYyRVvQ2i1ltBVZY+Acvxw+09hAT5X586FxInDbcyiKdTiqg98l6yK2E5KKpvDHi2xVMVBaOhEgvOEPxruvmT9+nhreXsJD3ZSLN73P7vgmj+xJsQ2bCk632wiwOR8WPIWA6+WwO+3qmvvP/cDRf2nyqAVYnuHoDVK3i+viyeBvG1cwMjFve/GA71v8a1eba/bHsLUvXx/zeXUBUz+6KNhaEttxGigDSch3nS0o8Dk97z8CXserqyuYlPQy4RORZ root@LinuxHelp
Open the browser and enter the IP address of the Gitlab server with the appropriate login credentials. Click on Settings as shown below. Select the SSH Keys menu to add the ssh key of your local machine on to the remote server. Add the ssh key and save the changes. Click on projects and Choose the Project that you would want to clone Click on Clone as shown below and copy the SSH URL.
Cloning the project Via SSH URL.
Switch over to the terminal and clone the project using git clone command as follows
[root@LinuxHelp ~]# git clone git@gitlab.example.com:root/ubuntu.git
Cloning into 'ubuntu'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
List the directories to verify project Ubuntu
[root@LinuxHelp ~]# ls -la
total 44
dr-xr-x---. 7 root root 267 Aug 1 11:19 .
dr-xr-xr-x. 18 root root 4096 Aug 1 11:19 ..
-rw-r--r--. 1 root root 129 Dec 28 2013 .tcshrc
drwxr-xr-x. 3 root root 47 Aug 1 11:19 ubuntu
-rw-------. 1 root root 657 Aug 1 10:55 .viminfo
Navigate to etc directory
[root@LinuxHelp ~]# cd /etc
Cloning Project Via HTTP.
Switch over to your browser and copy the HTTP URL Clone the project using HTTP URL by executing the following command as follows
[root@LinuxHelp etc]# git clone http://gitlab.example.com/root/ubuntu.git
Cloning into 'ubuntu'...
Username for 'http://gitlab.example.com': root
Password for 'http://root@gitlab.example.com':
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
List the directories to verify the Ubuntu Directory.
[root@LinuxHelp etc]# ls -la
total 1400
drwxr-xr-x. 3 root root 47 Aug 1 11:20 ubuntu
drwxr-xr-x. 3 root root 54 Aug 1 09:51 udev
drwxr-xr-x. 2 root root 26 Aug 1 07:22 udisks2
drwxr-xr-x. 2 root root 68 Aug 1 07:22 unbound
-rw-r--r--. 1 root root 163 Aug 1 07:20 .updated
drwxr-xr-x. 6 root root 103 Aug 1 07:22 X11
drwxr-xr-x. 6 root root 116 Aug 1 07:23 xdg
Change the directory to Ubuntu to view the repositories.
[root@LinuxHelp etc]# cd ubuntu
List the directory to verify the repository files of Ubuntu project.
[root@LinuxHelp ubuntu]# ls
asdf README.md
Switch Over to the Browser and verify the repository of the Project Ubuntu. With this, cloning of project via SSH and HTTP From Remote Gitlab Server to Local Machine On CentOS 7.6 comes to end.
Comments ( 0 )
No comments available