GitHub is a United States-based global company that provides hosting for software development version control using Git.
Git:- Git is a version control system that lets you manage and keep track of your source code history.
GitHub:- GitHub is the cloud-based hosting service that lets you manage Git repositories.
There are some basic steps to push the first project on GitHub, which are given below.
Step 1:- First-Time Git Setup
Now that you have Git on your system, you’ll want to do a few things to customize your Git environment. You should have to do these things only once on any given computer.
$ git config --global user.name "rajputankit22"
$ git config --global user.email firstname.lastname@example.org
Step 2:- Checking Your Settings
If you want to check your configuration settings, you can use the
git config --list command to list all the settings Git can find at that point:
$ git config --list
Step 3:- Create Repository
After setup git on our system, Login in your github.com and create a new public or private repository.
Step 3:- Initialise Repository
Firstly enter in your project’s root directory. Now we will initiate repository by the following command.
$ git init
Step 4:- add all files
git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
$ git add . // . means add all files
Step 5:- commit all new changes
commit command is used to save your changes to the local repository.
$ git commit -m "first commit" // -m for the message
Step 6:- add new remote
To add a new remote, use the
git remote add command on the terminal, in the directory your repository is stored at.
$ git remote add origin https://github.com/rajputankit22/firstrepo.git
Step 7:- push content
The git push command is used to upload local repository content to a remote repository.
$ git push -u origin master
Now your code is saved in GitHub, you can share, access and collaborate with anybody through the username.