DEV Community


Posted on

Pushing Local Project to Github for the First Time


1) Create a new repository on
You'll do this on the website.

2) In the terminal navigate to your projects directory

3) Initialize the local directory as a Git repository.
This is like making your local project compatible with Github.

$ init
Enter fullscreen mode Exit fullscreen mode

4) Add and Commit files.

"git add ." tells git that you want it to look at all these files.

"git commit -m" tells git that you want it to take a picture of those files and commit its current state to memory.

$ git add .
$ git commit -m "comments on this commit"
Enter fullscreen mode Exit fullscreen mode

5) Copy the SSH-URL of the repository you created in
(see differences between using the SSH-URL or the HTTPS URL)

6) Connecting your project to your Github repository.

$ git remote add remoteName SSH-URL
Enter fullscreen mode Exit fullscreen mode

This part is like creating a remote control for your project so that it can do stuff to a repository on
You "program the remote control" to work with a specific repository by supplying it with the URL that you copied. Since you will probably be making other remote controls for other projects and other repositories, you'll want to give this remote a unique name. Wouldn't it be annoying if all of your remote controls that you need for your TV, sound system, Roku, etc. all looked the same?

7) You are now ready to "push" your project up to
This is where the picture that was taken by the commit command gets "pushed" by the remote control to the repository.

$ git push remoteName main
Enter fullscreen mode Exit fullscreen mode

This line of code specifies the remote that you want to use, and what channel you want to go to. The save point that you committed to memory about your files is then sent to the "main" branch (or channel) of your repository and you'll now be able to see your project on

Further Reading about managing remotes

Top comments (0)