Push your code to GitHub using the command line
On your GitHub profile click “new repo”, give it a name, brief description, choose the “public” repo option, and click “create repository”. In the command line, make sure you cd into your project folder and type:
$ git init
This initializes a git repository in your project. Next check if a file called READEME.txt exists in your project directory. If the file doesn’t exist, create it by typing:
$ vim README.txt
$ git status
This will list out all the files in your working directory.
$ git add .
This adds in all of your files & changes so far to a staging area.
$ git commit -m "first commit"
This commits all of your files, adding the message “first commit”
$ git remote add origin https://github.com/username/project_name
Your GitHub Repository page will list the repository URL. You can copy and paste the link from your GitHub repository page by clicking the clipboard icon next to the URL.
This creates a remote, or connection, named “origin” pointing at the GitHub repository you just created.
$ git push -u origin master
This sends your commits in your “master” branch to GitHub
Congratulations your code is on GitHub!
Updating a local repository with changes from a Github repository
$ git pull origin master