DEV Community

Cover image for CREATING A FOLDER USING GIT BASH AND PUSHING IT TO GITHUB
THEODORA
THEODORA

Posted on

CREATING A FOLDER USING GIT BASH AND PUSHING IT TO GITHUB

Git is a distribution version control system that multiple developers use to work on a project.

GitHub is a cloud platform that uses Git as its core technology.
To create a code and push it to GitHub using Git bash. Here is a step-by-step process.

  1. Open your git bash terminal and enter your details using the following commands git config --global user.name "your username" git config --global user.email "your GitHub email"
  2. cd ~ and create a directory (folder) using the command mkdir mkdir "directory name"
  3. Enter into the directory you create using the cd command cd "directory name"
  4. Then initialize your master branch by running the command git init
  5. Create a file name index.html by running the command touch index.html
  6. To input the html code in the file run the command vi index.html, a new page will open, paste the code you have copied or write your own code and exit with the escape (esc) botton, save and quit the command :wq
  7. To check the content of the file run the cat command cat index.html
  8. Open your GitHub account on a browser in order to create a repository.
  9. Click on the icon that has your profile picture and click on repository.
  10. Click on New and give your repository a name, make sure it is Public. check the Readme box and click on create repository 11.Once is done you will see a green icon with the name Code, click on it and copy the https URL.
  11. Go back to Git bash and run the command git remote add origin " paste the URL" you copied, and press enter.
  12. To add your code on run the command git add index.html.
  13. To check if the file was actually added in your git run the command git status
  14. Now let's add a commit message using the command git commit -m " add any message of your choice", check the status again 16.Next input the major command to push your code, run the command git push origin master and press enter. 17.Now let's go to GitHub to see if truly we have successfully pushed. Click on the repository you created.
  15. Next click on main, and then click on master branch, you see the index.html, click on it to see the code you pushed. Attached is the screenshot of the above steps.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Top comments (0)