Skip to content

Instantly share code, notes, and snippets.

@johnparn
Last active January 29, 2018 08:16
Show Gist options
  • Save johnparn/adec2fb6147ec286d6c9df08cdad60cc to your computer and use it in GitHub Desktop.
Save johnparn/adec2fb6147ec286d6c9df08cdad60cc to your computer and use it in GitHub Desktop.

Add existing project to Github

Initialize the directory as a Git repository.

git init

Add files to local repository.

git add .

If you added files by mistake, for example node_modules, remove them and consider adding a .gitignore:

git reset HEAD -- node_modules

When done, commit the files.

git commit -m "Initial commit"

Setup the new repository at GitHub. Copy the new remote repository URL, like https://github.com/johnparn/my-new-repo.git

In terminal add the remote repository.

git remote add origin https://github.com/johnparn/my-new-repo.git

Check that the remote works:

git remote -v

Push code.

git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment