DevOps Series: Starting Up And The Basics Of GitHub

The Basics Of GitHub

Previous Blog: DevOps Series
----------------------------------------------
Overview & Purpose

Git allows groups of people to work on the same projects/files/documents (often code) at the same time and that too without stepping onto each other's toes. It's a distributed version control system. 
 

Commonly Used Git Commands:

    1.From the Scratch:-

       a. git init ⇒ Initialize empty git repo
       b. git status ⇒ Check untracked/newly added files
       c. git add file_name ⇒ To add files/folders
       d. git status ⇒ Check status of added files
       e. git commit -m “commit_message(committed file_name)”
           file_name ⇒
To commit added files with the commit message
       f. git log ⇒ To check commit history
       g. git remote add origin https://github.com/user/repo_name.git (only when you’ve not              cloned repo) ⇒ Add remote origin into the empty repo
       h. git push origin master ⇒ Push code/files to the repo
 

    2. Cloning Existing Repo:-

       a. git clone git_repo_url ⇒ Clone code from existing repo
       b. git add file_name ⇒  To add files/folders
       c. git status ⇒ Check status of added files
       d. git rm file_name ⇒ To remove the file from repo
       e. git rm -rf folder_name/path ⇒  To remove the folder from repo
       f. git commit -m “removed file or folder” ⇒  Commit the changes with commit message
       g. git push origin master ⇒  To push code on the master branch.

How to set global and local git user.name and email?

Global⇒ 

    a. git config --global user.name “your-username”
    b. git config --global user.email “your-email”

Local⇒ 
    a. git config user.name “your-username”
    b. git config user.email “your-email”

Generate ssh-key with your email id⇒ 
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

I hope this blog helps you to expand your GitHub knowledge …Thanks! If you need more assistance regarding DevOps Services, feel free to contact us now.

--------------------------------------
Next BlogDevOps Series