How to Create a GitBash index.html file and Push it to GitHub
Tags: gitbash, github, repo
Published: 2023-07-08 22:21:06

The article will guild us through step-by-step procedure of learning how to use the command-line interface GitBash to create index files. The article will also show you how to upload your index files to GitHub.

*Prerequisites*
Install Git bash on your desktop
Create a GitHub account

#Work with a GitBash Local Environment#
*To Configure the GitBash Local Environment*
Open GitBash
Input git config - -global user.name “enter name”
Input git config - -global user.email “enter email address”

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opsf8zki6bp35vuwkv06.jpg)

*To Work with the Configured Local Environment*
Enter mkdir (folder name) - to create a directory "directory is displayed on the desktop" 
Enter cd (folder name) - to create a path into the directory

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rndtt16jm0u9v8zqfniq.JPG)
Enter git init - to initialized the directory 

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wy3z0jjv7097tvxdz0r.JPG)
*To Create a Text Document in a Directory named “index.html”*
Enter touch index.html

*To add html code into the index.html file created*
Enter vim (folder name)
Copy the developed code, input i enter and paste the code in the displayed page
Enter :wq to save the pasted code in the displayed page

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jhv03ixovxm5wfifels.JPG)
To confirm if the code has been saved in the file, click to open the displayed directory on the desktop

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/esmweqewnbwj5zsy1syu.JPG)

#How to Clone a GitHub Repository in Windows#
First create new repository by clicking on plus-sign on the right corner of the browser page 

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aw5p45lk862cyhzy57ol.JPG)

Enter the repo name and select Add a README file

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ujoeerlhtpxayyobajqy.JPG)

Click on create repo

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kq2ly4sdspv5dsepo60v.JPG)
Repo is successfully created
Click on code, local and copy the displayed URL http://github.com/USERNAME/REPOSITORY

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isuwf5bjjeaiu7z2fnnh.JPG)
Enter git remote add origin and paste the above URL
Enter git add index.html – to add to staging area (i.e. add index.html file)
Enter git status - to confirm the tracking of the file by git.

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5ldo39en2y3dybf5vz5.JPG)
*To Create a Commit Message*
Enter git commit –m “My first commit Message”

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9it20ff63s19x85kpk7.JPG)
#To push the index.html file to GitHub Environment#

Enter git push origin master
Input the Username/Email and Password (Note: Password is a generated token from the account profile – setting – developer setting – personal access token – generate new token ...)
Copy the generated token, and use it as the password to push to gitHub

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/060lo03khy1j8z5dxi4h.PNG)

To show if the directory as being pushed to the Github
Go back to the Github local environment to confirm if the directory is displayed.

![gitbash and github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suay9zg2ywec9bz8wjp4.JPG)