The first step
To host to GitHub, you should have a GitHub account that belongs to you, so you should go to github.com to register
Open your browser
Enter address in address field: github.com
Fill in the user name, email, password
Simply register by clicking Sign Up
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/16/wKioL1c3Tg-jR603AACeB8wRrnI778.png "title=" Qq20160515000633.png "alt=" Wkiol1c3tg-jr603aaceb8wrrni778.png "/>
Complete the registration and go to the GitHub platform,
Click on new repositories to create an item (you can also add to an existing project)
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/19/wKiom1c3SnPjQIhQAABJjHx8QH0711.png "Title=" 000. PNG "style=" Float:none; "alt=" Wkiom1c3snpjqihqaabjjhx8qh0711.png "/>
Repository name: Usually write your own project name to build.
Description: That's your description of the project.
Select public.
If you do not want others to download initialize this repository with a readme can not choose
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/80/16/wKioL1c3S5Wg1AcnAADmaBpvQSA657.png "title=" 610036 -c1b6610ac5b1ff79.png "style=" Float:none; "alt=" Wkiol1c3s5wg1acnaadmabpvqsa657.png "/>
Click "Create Repository" to appear as a complete creation:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/19/wKiom1c3TNGT2ytZAAEhG39yt6I608.png "title=" Qq20160515000449.png "alt=" Wkiom1c3tngt2ytzaaehg39yt6i608.png "/>
Step Two
1. Create SSH: Open terminal to detect if there is SSH: command CD ~/.SSH
If it exists, first make an existing SSH backup, or build the new SSH into a different directory
If not present, SSH is generated directly from the default parameters
SSH-KEYGEN-T rsa-c [email protected] (email on GitHub), public key generation process always returns
2. Add SSH (shown) to GitHub:
Login to GitHub, click on profile picture Select Settings-->ssh and GPG keys--->new ssh key to add SSH
Title:[email protected]
Key: Open the Id_rsa.pub file you generated and copy the contents to this point.
Finally click on Add SSH key to save
3. Open the terminal, first test your account with GitHub is not connected: ssh-t [email protected] If the following prompt,
It means you're connected. (Because of the first step, so you do not have to do too much of the operation to connect GitHub, in addition,
The next time you want to connect to GitHub, remember to open the first step of the tool).
Hi miraclehe! You ' ve successfully
Authenticated, but GitHub does not provide shell access.
Follow the steps above (remember to switch the directory to the project directory you want to upload when you enter it in the terminal).
Simple analysis of the above steps:
The new project on GitHub can be done as follows
Touch README.MD//Create a new document for record submission operations
GIT init//Initialize local repository
git add readme.md//Add
Git Add project contains the files
Git commit-m "First commit"//submit to the repository and write some notes
git remote add origin [email protected]:youname/test.git//Connect to remote repository and build an alias named: Origin
Git push-u origin master//submits the local repository's stuff to the address that is Origin's address, under Master Branch, to complete.
There may be errors when you push the source code to GitHub using Git, with the following information:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/19/wKiom1c3SnmgqJdIAAApXwjQ-jA423.png "title=" 00.png "Style=" Float:none; "alt=" Wkiom1c3snmgqjdiaaapxwjq-ja423.png "/>
Workaround:
Git pull--rebase Origin master
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/80/19/wKiom1c3SqKgnvCgAAA87UQRd5k253.png "title=" 01.png "Style=" Float:none; "alt=" Wkiom1c3sqkgnvcgaaa87uqrd5k253.png "/>
Now execute the statement GIT push-u Origin master to complete the code upload to GitHub
As shown
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/19/wKiom1c3SqXS0Z5HAAApBXhlU60130.png "title=" 02.png "Style=" Float:none; "alt=" Wkiom1c3sqxs0z5haaapbxhlu60130.png "/>
View uploaded items
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/16/wKioL1c3S53QCDR5AAB1l1mUPw4718.png "title=" Qq20160514234115.png "style=" Float:none; "alt=" Wkiol1c3s53qcdr5aab1l1mupw4718.png "/>
This article is from the "Small Five Car God" blog, please be sure to keep this source http://linuxtech.blog.51cto.com/3670088/1773451
Create a GitHub account and upload items to GitHub