News Stay informed about the latest enterprise technology news and product updates.

How to git clone on Ubuntu with GitLab and GitHub

I’m not one of those software developers that shuns a Windows based GUI and portends that every operation performed on a computer is best performed using a command prompt or the BASH shell. But I can tell you that if you want to do version control with Git, the terminal window in Ubuntu is the best place to do it. Let me demonstrate that by demonstrating how to perform an Ubuntu git clone operation, taking all of the content from both a GitHub and a GitLab repository and copying it all down to my local machine.

Steps to Git clone on Ubnuntu

The following is the list of steps required to perform an Ubuntu Git clone:

  1. Open the Ubuntu terminal window
  2. Ensure and Ubuntu Git installation exists
  3. Issue the git clone command and specify the remote repo URL
  4. Navigate into the directory created by the Ubuntu git clone
  5. Perform basic Git commands such a push, branch, reflog and commt

How to Ubuntu git clone GitLab repos

The commands used in the Ubuntu git clone example where the target was a GitLab project are as follows:

git-clone@ubuntu:~$ sudo apt install git
git-clone@ubuntu:~$ git --version
git-clone@ubuntu:~$ git clone https://gitlab.com/cameronmcnz/gitlab-made-easy.git
git-clone@ubuntu:~$ cd my-github-repo
git-clone@ubuntu:~$ git config --global user.email "ubuntu-clone@example.com"
git-clone@ubuntu:~$ git config --global user.name "cameronmcnz"
git-clone@ubuntu:~$ touch my-file.html
git-clone@ubuntu:~$ git add .
git-clone@ubuntu:~$ git commit -m "good commit message"
git-clone@ubuntu:~git push origin master

GitHub Ubuntu git clone example

The process of cloning a GitHub repo in Ubuntu isn’t that much different. Since the first set of commands installed Git and performed the one-off config operations, the set of commands is more compact:

git-clone@ubuntu:~$ git clone https://github.com/cameronmcnz/my-github-repo.git
git-clone@ubuntu:~$ cd my-github-repo
git-clone@ubuntu:~$ git config --global user.email "ubuntu-clone@example.com"
git-clone@ubuntu:~$ git config --global user.name "cameronmcnz"
git-clone@ubuntu:~$ touch my-file.html
git-clone@ubuntu:~$ git add .
git-clone@ubuntu:~$ git commit -m "strong commit message"
git-clone@ubuntu:~$ git push origin master
git-clone@ubuntu:~$ git reflog

You can find these repositories on GitHub and GitLab.

 

 

 

 

 

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchAppArchitecture

SearchSoftwareQuality

SearchCloudComputing

SearchSecurity

SearchAWS

Close