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