The system used for this time is Centos6.4
First, we need to install GIT on the system
After the Yum source is configured, you can install the Yum directly.
Yum Install Git-y
Second, after installing Git, you can start to upload files.
The first step: we need to build our own git repository
CD to the file directory you need to upload, execute the git command, you can change your directory into a directory that git can manage
Here, I recreate a directory and generate a file
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/88/11/wKiom1fovBuBMA2eAAAh3-3dW0Q868.png-wh_500x0-wm_3 -wmp_4-s_87144717.png "title=" E909.tmp.png "alt=" Wkiom1fovbubma2eaaah3-3dw0q868.png-wh_50 "/>
Execute git init to build a git repository, and you can see a more. git hidden file in the directory
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/88/0D/wKioL1fovEPygweoAAAdR5dHqqE210.png-wh_500x0-wm_3 -wmp_4-s_884768773.png "title=" D9B.tmp.png "alt=" Wkiol1fovepygweoaaadr5dhqqe210.png-wh_50 "/>
Step two: Add files to our Git repository, note: Add. Indicates that all files under the current directory are added to the warehouse, or you can directly
git add filename just joins our specific file
git Add File// Add the specified file
git status// View the current status of the repository.
git commit// submit files to the warehouse
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/88/11/wKiom1fovHXAioA2AABJw53TJS8392.png-wh_500x0-wm_3 -wmp_4-s_3621180755.png "title=" E6BC.tmp.png "alt=" Wkiom1fovhxaioa2aabjw53tjs8392.png-wh_50 "/>
When we use git status, we can see that the current information is on the master branch and initialize the commit command, waiting for the commit
Step three: Commit commits, and-m indicates that a description can be added, at which point we submit the file to the repository.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/88/11/wKiom1fovKvz-M0lAABzatCX-DQ745.png-wh_500x0-wm_3 -wmp_4-s_430122070.png "title=" B85F.tmp.png "alt=" Wkiom1fovkvz-m0laabzatcx-dq745.png-wh_50 "/>
Fourth step: When we use git status to view the status of the warehouse, there is no initialization commit, indicating that we have committed a successful
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/88/0D/wKioL1fovNbg_cpcAAAV4kAqBmY072.png-wh_500x0-wm_3 -wmp_4-s_2875968567.png "title=" 63fb.tmp.png "alt=" Wkiol1fovnbg_cpcaaav4kaqbmy072.png-wh_50 "/>
Three: landing on your own github
The first step: after landing, we have to create a new warehouse (no account of their own, to register a good, very simple, but must remember to register the time to fill in the registered mailbox, very IMPORTANT!!! )
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/11/wKiom1fovQ7S4jl1AABZeqcVZsA116.png-wh_500x0-wm_3 -wmp_4-s_2066315000.png "title=" 2854.tmp.png "alt=" Wkiom1fovq7s4jl1aabzeqcvzsa116.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/0D/wKioL1fovSyBqzLUAACp231Y56w677.jpg-wh_500x0-wm_3 -wmp_4-s_2817527648.jpg "title=" A36E.tmp.jpg "alt=" Wkiol1fovsybqzluaacp231y56w677.jpg-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/88/0D/wKioL1fovVOBIc0ZAAByUdJmMGk413.png-wh_500x0-wm_3 -wmp_4-s_2560510415.png "title=" 44ed.tmp.png "alt=" Wkiol1fovvobic0zaabyudjmmgk413.png-wh_50 "/>
A similar interface appears above, indicating that the library was created successfully
Step two: because the transfer between your local git repository and the GitHub repository is encrypted via SSH, you need to set up SSH keys.
We enter our terminal, enter: Ssh-keygen-t rsa-c "Emai" #这里需要输入注册时填写的邮箱地址
I am using the QQ mailbox:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/88/14/wKiom1fo_U-xZE3AAACjR1_Kd78607.jpg-wh_500x0-wm_3 -wmp_4-s_3219570144.jpg "title=" 2e96.tmp.jpg "alt=" Wkiom1fo_u-xze3aaacjr1_kd78607.jpg-wh_50 "/>
Next, we need to fill the key value on our github:
Vim ~/.ssh/id_rsa.pub Copy the information below and wait for it.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/88/14/wKiom1fo_W7xNAR4AABpf969jDY711.png-wh_500x0-wm_3 -wmp_4-s_1064221864.png "title=" A406.tmp.png "alt=" Wkiom1fo_w7xnar4aabpf969jdy711.png-wh_50 "/>
Step Three: Login to your github to fill out key
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/88/14/wKiom1fo_Yix0zmwAABHhql682Q971.png-wh_500x0-wm_3 -wmp_4-s_717499109.png "title=" 1189.tmp.png "alt=" Wkiom1fo_yix0zmwaabhhql682q971.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/88/11/wKioL1fo_biyLS9gAAAmT504pLA537.png-wh_500x0-wm_3 -wmp_4-s_4256053128.png "title=" B71D.tmp.png "alt=" Wkiol1fo_biyls9gaaamt504pla537.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/88/11/wKioL1fo_d2AUWmCAADHHSgYh-k181.png-wh_500x0-wm_3 -wmp_4-s_3852404482.png "title=" 4827.tmp.png "alt=" Wkiol1fo_d2auwmcaadhhsgyh-k181.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/88/11/wKioL1fo_ffzwfj_AAB1G908MqM866.jpg-wh_500x0-wm_3 -wmp_4-s_3915318032.jpg "title=" D56A.tmp.jpg "alt=" Wkiol1fo_ffzwfj_aab1g908mqm866.jpg-wh_50 "/>
Note that for different hosts, the key value is not the same, so we can add more than one key value, in which I added two.
Step three: Test whether the SSH key is properly configured, and if the red part is your GitHub name, the SSH configuration is successful.
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/88/14/wKiom1fo_guyed6DAABcUskde-M588.png-wh_500x0-wm_3 -wmp_4-s_2361136452.png "title=" 2c71.tmp.png "alt=" Wkiom1fo_guyed6daabcuskde-m588.png-wh_50 "/>
Four: Add files to remote libraries
The first step: Enter the following command, note: followed by their own GitHub name, followed by the need to upload the library name
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/88/11/wKioL1fo_iTyTnvxAAAWhpPmIR4093.png-wh_500x0-wm_3 -wmp_4-s_3233863915.png "title=" 859a.tmp.png "alt=" Wkiol1fo_itytnvxaaawhppmir4093.png-wh_50 "/>
If an error occurs, follow the execution:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/88/14/wKiom1fo_juARMj9AAAin2eoW8w759.png-wh_500x0-wm_3 -wmp_4-s_850444313.png "title=" E410.tmp.png "alt=" Wkiom1fo_juarmj9aaain2eow8w759.png-wh_50 "/>
Step two: Use the git push command to complete the upload
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/88/14/wKiom1fo_lCh8cHDAABKjLrccc4849.png-wh_500x0-wm_3 -wmp_4-s_1536494625.png "title=" 3647.tmp.png "alt=" Wkiom1fo_lch8chdaabkjlrccc4849.png-wh_50 "/>
If the above error occurs, follow the execution: The above error occurs because, when the library is built, we have generated a readme.md file in the library, and the current path does not have this file, so we first pull the readme.md file from the remote to local, and then upload.
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/14/wKiom1fo_mqBacabAACkLFd0LME645.png-wh_500x0-wm_3 -wmp_4-s_906277116.png "title=" 8938.tmp.png "alt=" Wkiom1fo_mqbacabaacklfd0lme645.png-wh_50 "/>
At this point, we can see that it has been uploaded successfully, and we can see that there is more than one readrme.md file in the local
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/88/11/wKioL1fo_oXyzt5MAAALs8KomDw693.png-wh_500x0-wm_3 -wmp_4-s_4150831894.png "title=" F0F2.tmp.png "alt=" Wkiol1fo_oxyzt5maaals8komdw693.png-wh_50 "/>
Step Three: Login to our GitHub to see if there are any uploaded files in the library.
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/88/14/wKiom1fo_p_RwW4XAAB7m34mOCE208.jpg-wh_500x0-wm_3 -wmp_4-s_1793901724.jpg "title=" 60d5.tmp.jpg "alt=" Wkiom1fo_p_rww4xaab7m34moce208.jpg-wh_50 "/>
Summary: When uploading a file, the biggest problem is whether to correctly add the local key to remote GitHub, the contents of the Id_rsa.pub file should not be modified, otherwise it may lead to authentication failure. Remember to remember!!! If you do not understand the Ssh-keygen command, direct search Niang, or Google can
This article is from the "11456174" blog, please be sure to keep this source http://11466174.blog.51cto.com/11456174/1856737
Upload local files to GitHub under Linux