Have always wanted to learn the use of GitHub, very early registered account, but always thought it was difficult, dare not try. and want to share with others what they have done,
At the same time is a good place to host code, and finally the bite to try how to upload code, and now found that the original is not as complex as they imagined.
First step: Install the Git install Success flag on your computer: Right click on git GUI here and git Bash here,
The second step: we need to first create a local repository (in fact, a folder).
You can either right-click the new folder or right-tap the git Bash here Command Line window to create it from the command.
Now I'll create a new test folder on my desktop from the command line (you can also make this folder anywhere else) and go to this folder
Step Three: turn the test folder into a git manageable repository by ordering git init
At this point you will find that there is a. git folder in test, which is used by Git to track and manage your repository. If you don't see it, because it's hidden by default, you need to set it up so that the hidden file is visible.
(Click the check box above the current folder to see the hidden items before you can show hidden files)
Fourth Step: at this point you can paste your project into this local git repository (that is, test) (you can check your current status with Git status after pasting), and then add the project to the repository via git add (or git Add. Adds all the files in this directory to the repository, noting that the points are separated by spaces. In this process you can actually always use git status to see your current status.
At this point, I pasted the item, but there is no add to the local git repository, so we have git Add. Add all the items you just copied to the warehouse (note that there are spaces between add and.)
Fifth Step: commit the project to the GitHub remote repository with git commit. -M behind the quotation mark is the submission of the comment content, this can not be written, but it is best to write, or will error, the details of Google itself.
Here, the local git repository is finished, and the remote repository is connected below (that is, GitHub is connected)
Because the transfer between the local git repository and the GitHub repository is encrypted via SSH, the connection needs to be set up:
Sixth step: create SSH KEY. Take a look at your C-drive user directory there is no. ssh directory, some words to see if there is no Id_rsa and id_rsa.pub these two files, have jumped to the next step, did not create by the following command
$ ssh-keygen-t rsa-c "[Email protected]"
Then return all the way. At this point you will find the Id_rsa and id_rsa.pub two files in the. SSH directory under the user.
Seventh Step: Login to GitHub, find the upper right corner of the icon, open the point into the inside of the settings, and then select the inside of the SSH and GPG keys, click on the upper right corner of the new SSH key, and then the title filled, then put just id_ Rsa.pub inside the content copied to the title under the Key Content box, and finally click on the Add SSH key, so that the completion of the SSH key encryption. Specific steps can also be seen below:
Eighth Step: Create a git repository on GitHub. Can be created directly from the new repository, for example, I created a ZZW warehouse.
nineth Step: After creating a git repository on GitHub, we can associate with the local repository, which can be entered at the command line of the local test repository, depending on the prompt to create a good git repository page:
$ git Remote add Origin https://github.com/Ares2333/ZZW.git
Note that origin is appended with the address of the warehouse you created on GitHub.
Tenth step: After the connection, we can push all the contents of the local library to the remote Repository (GitHub), by:
$ Git push-u Origin Master
Because the new remote warehouse is empty, so add-u this parameter, and so on the remote warehouse inside the content, you can not need. After the final completion of the interface is as follows
Refresh the GitHub interface at this point to see the project upload is successful, in the personal center your profile can find your uploaded project reference link
Note: If you encounter the remote origin already exists error resolution is as follows:
1. Delete the remote Git repository first
$ git Remote RM origin
2. Add the remote Git repository again
$ git Remote add Origin https://github.com/Ares2333/ZZW.git
Uploading local projects to GitHub