Steps For Installing Git on Ubuntu 18.04 LTS

(143 Views)


What is Git?

Git is a SCM (Source Control Management System) software that is used for Version Control. It is open source, so its free.
Now, let's understand what is Version Control.
Version Control is the management of changes to documents, computer programs, large websites and other collection of information.

Git allows a people in a team to work together, all using the same files. And it helps the team cope with the confusion that tends to happen when multiple people are editing the same files.

In this post you will see steps for Installing Git on Linux Ubuntu 18.04 LTS.

Ubuntu 18.04 Git Install

  1. Install git
  2. sudo apt-get update sudo apt-get install git

  3. Check if git is installed?
  4. git --version

    For information on git commands you can use help command

    git help

  5. Configuring Git in Ubuntu 18.04 LTS
  6. git config --global user.name "your name" git config --global user.email "your.email@example.com"

    You can also view all the configuration that have been done by following commands:

    git config --list

  7. Creating first repository and Committing code using git
    • Creating first repository :
    • mkdir testing cd testing git init
      In the above code, we have created a new folder "testing" and initialized git in "testing" folder using git init command. Inside "testing" folder you should see a .git directory created which indicates that the git is initialized.
    • Create a Sample File
    • touch newFile.java
    • Adding file for Git commit
    • git add newFile.java
    • Committing file with a message
    • git commit -m "my first commit"

  8. Pushing Code to Server
    • Setting Remote origin
    • git remote add origin youruser@yourserver.com:/path/to/my_project.git
    • Pushing Code
    • git push origin master

Solution Worked 0 UpvotesUpvote

        

Solution Didn't Worked 0 DownvotesDownvote



Comments



Search