Follow the steps given below to upload your first codebase to GitHub:
-
First of all, you need to install git on Windows. (Download Git from here)
-
Install the git in default settings.
-
After installing git, you need to set your name & email address in the Git configuration. This information will be displayed every time you make a new commit.
Type the below command to configure your name:
git config --global user.name "Your Name Here"
-
Similarly, you need to configure your email address by typing the command given below:
git config --global user.email "Your Email Here"
-
Now, head over to github.com and create a new repository in which you want to push your project.
-
Now, right-click on the folder containing the codebase which you want to push to GitHub and select “Open git bash here.” I will be pushing an “index.html” file which is inside my Github Demo folder which you can see in the below animation.
-
On clicking “Git bash here”, a new git bash terminal window will open!
-
Now, initialize the local directory as a Git repository by typing:
git init
-
Now, you need to add the files to the staging area (git will only track the files inside this area). Run:
git add .
Typing the above command will stage all the files inside the local directory. If you want to stage only one file, type:
git add "file-name"
-
The next step is to commit your staged files by typing:
git commit -m "Type message of your choice here"
-
Now, copy the link to the repository which you created in step 6.
-
Now, type:
git remote add origin <Paste-Git-URL-Here>
-
The last step is to push your codebase to GitHub. Type the command given below:
git push origin master
Refresh the repository page and you will see that your files are successfully pushed to Github.
Congratulations on uploading your first codebase on GitHub!