DEV Community

Gbadamosi Tajudeen
Gbadamosi Tajudeen

Posted on

How to Create a GitBash index.html file and Push it to GitHub

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

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
Enter git init - to initialized the directory

gitbash and github
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
To confirm if the code has been saved in the file, click to open the displayed directory on the desktop

gitbash and github

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

Enter the repo name and select Add a README file

gitbash and github

Click on create repo

gitbash and github
Repo is successfully created
Click on code, local and copy the displayed URL http://github.com/USERNAME/REPOSITORY

gitbash and github
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
To Create a Commit Message
Enter git commit –m “My first commit Message”

gitbash and github

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

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

Top comments (0)