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”
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
Enter git init - to initialized the directory
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
To confirm if the code has been saved in the file, click to open the displayed directory on the desktop
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
Enter the repo name and select Add a README file
Click on create repo
Repo is successfully created
Click on code, local and copy the displayed URL http://github.com/USERNAME/REPOSITORY
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.
To Create a Commit Message
Enter git commit –m “My first commit Message”
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
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.
Top comments (0)