Adding an existing project to github

I always forget how to add my local projects (on my mac) to github. That’s why decided to record the steps here so I remember them in the future.

So, given that you have an existing project on your machine,

    the steps are :
  • 1. Create a github repo on the github website
  • 2. Copy the URL of the repo
  • 3. Go to the terminal and navigate to the directory with the project
  • 4. in the terminal type: git init
  • 5. then type: git remote add origin /path/to/project-url-on-git
  • 6. git add .
  • 7. git commit -m "initial commit"
  • 8. git push -u origin master

That’s all needed to set up a git repo for the already existing project. I used to forget adding origin to my repo (step 5), but hopefully not any more.

Written on January 30, 2018