justask.dev

Community powered answers to your dev questions

Add an existing project to git

posted: 2019 December 6th

category: git

Edit this post on GitHub.

Back

To start you should create a repository on your github. Then from your terminal move into your project root folder and run the following commands.

1git init
2git add .
3git commit -m "My first commit"
4git remote add origin <remote repository url>
5git remote -v
6git push origin master
  • First we are initializing the local directory as a git repo

  • Then we are adding the new files in your local repo, this stages them for the first commit

  • Then we commit the files that we just staged

  • Copy the remote repo url from your github repo and add it to the remote repo where your local repo will be published

  • Set the new remote

  • Push the changes in your local repo to github

Author: Rich Haines