What is GitHub(And Basic Commands)
GitHub is a Website and cloud based service that helps to store and manage their code, as well as track and control changes to their code. To understand what is GitHub is, you need to know two connected principles.
Version Control: version control allows to keep track of your work and helps you easily explore the Changes you have made.
Git: Git is a open source version control system created by Linus Torvalds in 2005.
In Git We have, Two kids of Repositories
Public Repository: Public Repositories are accessible to everyone on the internet
Private Repository: Private Repositories are Only accessible to you, people you explicitly share with, and for organization repositories, certain organization members.
To Get Started:
Step 1: Install latest Version of Git on your device, After installing the Git, go to GitHub's Website and create an account with your username and password.
Step2: Once you created the account , you will be taken into dashboard. To create a repository, click create repository button.
After giving the Details Press create repository button.
Step 3: Create a new file in the repository
Give Some message and commit the file.
Git Basic Commands:
Git clone: git clone creates the local copy of the project that already exists remotely. The clone includes all the project files , history and branches.
Git add: git add moves changes from the working directory to staging area.
Git pull: git pull updates the local line of development with updates from its remote counterpart. we use this command, if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.
Git push: git push updates the remote repository with any commits made locally to branch.
Step 4: cloning:
Copy that path, For cloning you need Git Bash, download Git Bash-- https://git-scm.com/downloads .
Create a folder in your c driver or d driver or in my documents where ever it is .
open the folder and click git bash here.
you will get a CLI(Command Line Interface). Type the command git clone and paste that path here.
It cloned to your local
so, you can make your desired changes in your local.
Step 5: Add those changes to your file by using add
and then Commit
if you see this message , enter your email id or username
git config--global "Yourgithubaccountid@test.com"
git config--global "your githubaccountusername". After gave those details try to commit again .
once it is committed, push your code by using git push.
Step 6: For push the code to your original code, you need to take personal token for security purposes, take the personal token. Search google how to take personal token in git hub. After took that token , paste that token here.
It Successfully, push your code to your git hub account remotely. if you want to check open your github account repository and see the changes.
Step 7:Use the git pull command for pulling the code.
It pulls the code that changed by your teammate remotely, to your local.