In this tutorial, we will, How can you Set GIT and GITHUB.
To perform this first you need to setup or install the GIT on your local machine. We have already seen, what is GIT and how we can install the GIT.
GIT and GitHub both are the different things GIT is a VCS system, what you can install on your local machine. GitHub is a website, you can’t install it.
GIT is a repository and GitHub is the server used to maintain this repository.
GIT helps us to version our code or to upload the code on server and GitHub is the server which keeps the repository.
GitHub is the free server (up to some limit), To use GitHub, First you need to create the account on GitHub (https://github.com/) .
Push Code using GIT to GITHUB
We will see, how can we upload the project on GitHub using GIT.
- Open Git Bash. (Type GIT Bash in your window run prompt)
- First, You need to provide the username in Git bash. This name will display in your commit name. So type command —
git config –global user.the name “YOUR NAME” (Put your name in quotes)
- Tell Git the email address that will be associated with your Git commits. use command —
git config –global user.email ”email”
- Now log-in your GitHub account and Create the New repository. The repository is a folder where we will place our source code files on the server.
- To create new Repository on GitHub. Click “+New repository” button.
- Enter the name of your repository, I named mine ‘SeleniumBix’. It should be the name of Project, you working on.
- Select Initialize this repository with a README.
- Click ‘Create repository’ button.
- Now go to Git Bash and switch the directory, Where you want to clone this GitHub repository. Like, I want to clone project in my D drive so I will switch to D drive first using command –
- Now clone the SSH URL of your repository by click on Clone icon present on the left bottom side of your page.
- Clone the project using command —
git clone https://github.com/anshulc55/SeleniumBix.git
- Now you can switch to your Project directory. Because it is cloned into your local machine. You can switch by command–
- Now go to your local and modify the Readme.md file (Modify using Notepad++).
- Now go to the base and type command ‘git status’ . It will give you the list of modified and still not committed files.
- To commit the changes on the server, first, you need to add the changes. Use ‘git add’ command to add the changes.
- To commit use command ‘git commit -m “My second commit” ‘, here my second commit is the comment.
This is all how we can connect the GIT with GitHub and perform the operation using Git Bash. We will learn the GIT in details in GIT Tutorials.