This tutorial, combined with GitHub server and client completion of native code upload to GitHub, is explained in detail below:
1. To create a GitHub account, this step should not be explained too much, directly to the last Officer Network registration login can https://github.com/
2. Create a new repository. , after registering login can find the following page, create a new repository.
The following page appears when you create a new repository, where I have created a new named Test, which can add descriptive information, determine the access rights of repository, and in order to make it easier to coder understand your code, you can tick the Generate Readme (not now generated, Later can also be generated, this is not a problem) at this time, repository has been established, you can see the following page, indicating that the repository has been set up test to upload the local code, need to download a corresponding platform GitHub client, I use Windows, So download the version of Windows, you can choose according to your own circumstances, as follows: https://desktop.github.com/after the download is complete installation, the installation process without explanation, wait. After the installation is complete there should be a GitHub client and Gitshell two applications, which is basically not a problem.start the play below, upload your local code to GitHub3. Generate key Open Git Shell enter the following command: ssh-keygen-c "[email protected]"-t RSA (for example: ssh-keygen-c "[email protected]"-t RSA) three consecutive returns (Ente R) to generate the key that belongs to you, and in the user directory (my directory is C:\Users\LEESF), the following is generated. SSH folder: The directory structure in the. SSH folder is as follows: Open id_ Rsa.pub can view the generated key to copy the key to GitHub, open GitHub personal settings, click on Settings, click on SSH keys after clicking on the Add SSH key after the title can be seen in the mood to fill, key copy paste Id_ Rsa.pub the key in the key, and then click Add Key to complete the key, you can test in the shell, enter the following command: ssh-t [email protected]
The correct results are displayed:
warning:permanently added ' github.com,207.97.227.239 ' (RSA) to the list of known hosts. Hi leesf! You've successfully authenticated, but GitHub does not provide shell access.
Warning, don't bother.
4.clone just created a new repository named Test to local, enter the command:
git clone https://github.com/leesf/Test.git
The following directory structure is then generated locally:
5. Copy the code folder you want to upload to GitHub (in the same directory as. git) and copy the Test folder (containing the Test.java file) to this directory.
6. Start Uploading Files
In the shell, enter the following command in turn:
Git init
git add Testgit commit-m "Test.java" git remote Add origin Https://github.com/leesf/Test.gitgit push Origin Maste R
If you execute git remote add origin https://github.com/leesf/Test.git an error occurs:
Fatal:remote origin already exists
The following statement is executed:
Git remote RM origin
Execute git Remote add Origin https://github.com/leesf/Test.git again .
When executing GIT push Origin master, an error occurred:
error:failed to-push som refs to ....
The following statement is executed:
Git pull Origin Master
First pull the file from github above the remote server and push it up.
The entire upload process is complete, and you can now view your uploaded source code on GitHub.
One reference link: http://www.cnblogs.com/ruofengzhishang/p/3842587.html
GitHub uploads local code in a detailed