First, you need to make it clear that git is a version management tool that can host code to any licensed place; GitHub is one of them.
I will not talk about applying for a GitHub account or anything.
After applying, you need to establish a unique connection with the local machine on GitHub. Implemented by the SSH public key, see: http://www.cnblogs.com/igrl/archive/2010/09/17/1829358.html
Upload code:
Before each code upload, create a repository on GitHub to copy its unique ssh.
Then enter the code folder in git bash,
Git init
Git add XXX1
Git commit-M "xxx2"
Git remote add origin xxx3
Git push-u origin master
XXX1 is a file to be hosted. You can use git add * to add all files in the folder, or use git add *. cpp to add all. cpp files in the folder;
Xxx2 is the description of this submission;
Xxx3 is the dedicated SSH repository mentioned above.
Note: (1)You can add multiple times before performing commit;
(2)Add can add.../to add the code in the subordinate folder of this folder. One advantage of this is that, at the same time on GitHubGenerate a folder.
Refresh now and check the repository on GitHub. Is there a lot more in it?
Download Code:
To download the code, open git bash, write down the SSH record of the project to be downloaded as XXX, and enter the command:
Git clone xxx
Check the root directory of git Bash. Is there an extra folder?
Quick GitHub tutorial