In this artice we learn how to install github. As we know that Git is an open-source distributed version control software and we use git for versioning our software.
Using git we can upload our code on a central location called git repository. To upload our code on git we require below tools:
- A GitHub account
- Git installed on your window machine
How to create GitHub account
To create GitHub account you have to follow the below steps:
- Go to the GitHub website URL ( open Github ).
- Click on SignUp.
- Fill the form and click on Create account.
- Now you will get an email from GitHub click on the verify link.
How to install github on windows
To install Git on your window system you have to follow the below steps:
- Go to the git website using URL ( open git )
- Click on download.
- Now your download will start.
- Go to download folder and open the .exe file.
- You have successfully installed the git.
After this click on Next on every window. Do not change the default setting just click on Next on every window.
After completing all steps you will get a window click on Launch Git Bash and after that click on finish.
Now just check the version of the git using below command.
So congrats till now you have successfully setup both the steps. You have created your account on GitHub and you have also installed git on your window machine.
Till this point we have complete git setup. Now lets see how to upload your file from your computer system to your GitHub repository through the git commands.
Lets see what we are going to do using below steps:
- Create a folder on our system.
- A .txt file and write some data in that file.
- Create a GitHub repository.
- Commit our .txt file means give some message to your commit so we can recognizes our version using this message.
- Link GitHub repository URL to our folder.
- Push our .txt file to the GitHub repository.
To follow above steps you must have some basic knowledge about the below Linux commands.
We use mkdir command for creating the folder. In this example we create a folder with name myGitHubFolder.
cd command is using for go inside the directory or folder of the given path.
touch command is using for creating the files. In our case we create a .txt file using this touch command.
vim command is using to open the .txt file and use to write some text inside that file.
After using the above command a window display. After the press i from your keybord.
i is used for insert. After that write some text in that file and save. For saving data we have to press the below keyword.
esc : wq!
and press enter after typing above keywords.
Till now we have created a Folder with name myGitHubFolder and after that we create a .txt file inside this folder with name myGitFile.txt and put some text inside that.
Now we have to create a GitHub repository and for that we have to Sign in to our GitHub account and create the new repository.
You have successfully created a GitHub repository and after creating that you will see some commands display on that repository .
git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/vasurajput/JavadreamRepositry.git git push -u origin main
Now open you git bash terminal and follow the below steps:
- Initialize git using git init command
- Add your .txt file using git add . command.
Now add GitHub user and GitHub repository URL to git bash.