DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,611 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Push First Project to Github (First use of Git Bash)
Mustapha DABELLA
Mustapha DABELLA

Posted on

Push First Project to Github (First use of Git Bash)

Today I will guide you to push your own local files to your GitHub as Repository so here simple steps:

1- First of all, you have to create a GitHub account if you don't have one, then log in, after that you have to create your new repository.

2- Give a Name to your repository (don't check: Initialize this repository with README.md if you want to add your own README) and click Create Repository.

3- Download and install Git Bash and during installation, you can choose options that you prefer.

4- Launch Git Bash Command Line and change the current directory to the location of your project files using this command: "cd"
Example: cd /Desktop/Projects/ProjectToPushToGithub

5- Type this command "git init" (without double quotes) and hit enter and you will get a new folder named ".git".

6- Run this command: git remote add origin UrlOfYourRepository
Example: git remote add origin https://github.com/mustaphadabella/BookPage.git

7- Run This Command: git push -u origin master
If you get an error like this:
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/mustaphadabella/BookPage.git'

Solution of the error:

Run this command: git add -A

8- Run This Command to commit: git commit -m 'initial commit'

9- Next Run This Command: git push -u origin master
note: if it's your first time a popup will display to login to your Github Account so you enter your email and password to log in to your account.

10- Finally, Check your GitHub account you will find all your project files in your Repository.
I hope this article was useful for you and HAPPY CODING!

Top comments (1)

Collapse
 
dmredhat profile image
DMredHat

Simple and Clear steps thanks

πŸŒ™ Dark Mode?!

Turn it on in Settings