In this tutorial, we explain to you how to upload a project to Github on your Windows desktop.
What is GitHub?
GitHub is a code hosting platform for collaboration and version control. GitHub lets you (and others) work together on projects.
Let see how to upload a project to Github on windows
1. Install git and create a GitHub account
The first two things you’ll want to install git and create a free GitHub account.
Follow the instructions here to install git (if it’s not already installed). Note that for this tutorial we will be using git on the command line only. While there are some great git GUIs (graphical user interfaces), I think it’s easier to learn git using git-specific commands first and then to try out a git GUI once you’re more comfortable with the command.
Once you’ve done that, create a GitHub account here. Accounts are free for public repositories, but there’s a charge for private repositories.)
2. Create new Repositories
Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or files. You can add these files after your project has been pushed to GitHub.
Click on New repository
Repository means a folder which contains all files. Simply type a repository name and give a description(optional) and click on a Create repository.
When you click on Create repository this quick setup is open. we follow this command to upload a project.
3. Open Git Bash
Simply search Git bash and open.
4. Change the current working directory to your local project.
Means make a directory anywhere. Paste the path of that directory into bash.
To do that write in bash:- cd ” path-name ”
Or you can go to that folder > right-click > Git Bash here
5. Initialize the local directory as a Git repository.
To do that write in bash:- git init
You can see .git folder in your folder.
6. Add a file to the staging area
Add a file by using ” git add <file-name> ” for a single file.
To add all files, use “git add . “
7. Commit a file into the git repo is to write a commit message.
8. Push the file into a remote repository. {{Github}}
git remote add origin git@github.com:"Username_on_github"/"Repository_Name"
9. Setting up Git
If we are setting up the git for the first time, we can configure the git with name & email.
git config –global user.name “Your_Name”
git config –global user.email “Your-Email”
10. Final PUSH
When to type “git push origin master” a pop Github login window opens. Enter the username or email and password and click on the Login button.
11. Check to Repository
Refresh Repository page and you will find your files in repositories.
Adding an existing project to GitHub using the command line
Here you can see I add 1 file, that name is technotaught.txt
To push this file into the GitHub repository follow the step below
1. Add a file to the staging area
Add a file by using ” git add <file-name> ” for a single file.
To add all files, use “git add . “
2. Commit a file into the git repo is to write a commit message.
Command: -> git commit -m “first commit”
3. Final PUSH
Command: -> git push -u origin master
4. Check to Repository
So this explains, how to upload project to Github on windows. Let us know in the comment section if you have any problem related to Github.