iOS巅峰之GitHub设置和xCode代码上传的详解步骤

GitHub验证方式

上传GitHub的时候是需要身份验证的,而验证身份的方式有两种: 
1. 通过用户名以及密码验证 
2. 通过SSH秘钥验证

以上两种方式都可以进行验证,不过个人而言,还是比较喜欢用SSH秘钥的,至于为什么呢,相信以后用到的时候您自然明白用SSH秘钥的便利之处。所以这里就只说明一下如何配置SSH秘钥


配置SSH秘钥的位置

  1. 注册之后,登陆进GitHub,在右上角选择身份下的Settings(配置)选项,效果如下图  
    打开身份下的Setting选项 

  2. SSH and GPG keys 
    SSH and GPG keys 

  3. 因为本人已经设置过SSH了,所以这里会显示一个SSH秘钥,不过没关系,第一次设置肯定会是下面的情况,Title写GitHub的账号即可: 

    添加新的SSH秘钥 

验证是否存在SSH秘钥

接下来就需要找到咱的Key了,说到找Key,他就存在一个叫做id_rsa的文件里面,如何找到这个文件呢?

通过在终端中使用命令行来验证是否已经存在SSH秘钥

<code class="language-Ruby hljs avrasm has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">ls -al ~/<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.ssh</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

如果终端出现下面代码行,就说明已经生成过SSH秘钥

<code class="language-Ruby hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">RunIntoLoveMacBook<span class="hljs-attribute" style="box-sizing: border-box;">-Pro</span>:~ yuewen$ ls <span class="hljs-attribute" style="box-sizing: border-box;">-al</span> ~<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">/</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>ssh
total <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>
drwxr<span class="hljs-attribute" style="box-sizing: border-box;">-xr</span><span class="hljs-attribute" style="box-sizing: border-box;">-x</span>   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span> yuewen  staff   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">204</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">11</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">30</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">17</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
drwxr<span class="hljs-attribute" style="box-sizing: border-box;">-xr</span><span class="hljs-attribute" style="box-sizing: border-box;">-x</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">+</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">35</span> yuewen  staff  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1190</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">12</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">47</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">..</span>
<span class="hljs-attribute" style="box-sizing: border-box;">-rw</span><span class="hljs-attribute" style="box-sizing: border-box;">-r</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">--</span>r<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">--</span>@  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> yuewen  staff  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6148</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">12</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">12</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">12</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>DS_Store
<span class="hljs-attribute" style="box-sizing: border-box;">-rw</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-------</span>   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> yuewen  staff  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3326</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">14</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">08</span> id_rsa
<span class="hljs-attribute" style="box-sizing: border-box;">-rw</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-------</span>   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> yuewen  staff   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">742</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">14</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">08</span> id_rsa<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>pub
<span class="hljs-attribute" style="box-sizing: border-box;">-rw</span><span class="hljs-attribute" style="box-sizing: border-box;">-r</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">--</span>r<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">--</span>   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> yuewen  staff  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2794</span>  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">29</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">18</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">09</span> known_hosts</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul>


已经存在SSH秘钥

这种情况,只需将key复制出来,然后黏贴到配置中的key中即可,使用一下命令行就完成对key的copy操作

<code class="language-Ruby hljs avrasm has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">pbcopy < ~/<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.ssh</span>/id_rsa<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.pub</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>


不存在SSH秘钥

不存在SSH秘钥也不需要着急,生成一个就行,下面的操作也在终端中进行

1.创建一个新的SSH秘钥

<code class="language-Ruby hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">ssh<span class="hljs-attribute" style="box-sizing: border-box;">-keygen</span> <span class="hljs-attribute" style="box-sizing: border-box;">-t</span> rsa <span class="hljs-attribute" style="box-sizing: border-box;">-b</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4096</span> <span class="hljs-attribute" style="box-sizing: border-box;">-C</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"your_email@example.com</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

2.确定一个保存秘钥的文件,默认就是id_rsa,确认即可

<code class="language-Ruby hljs livecodeserver has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">Enter <span class="hljs-operator" style="box-sizing: border-box;">a</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">file</span> <span class="hljs-operator" style="box-sizing: border-box;">in</span> which <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">to</span> save <span class="hljs-operator" style="box-sizing: border-box;">the</span> key (/Users/you/.ssh/id_rsa): [Press enter]</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

3.确认一下密码,完成对秘钥的生成

<code class="language-Ruby hljs oxygene has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">Enter passphrase (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">empty</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span> no passphrase): [<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">Type</span> a passphrase] // 输入github的登录密码
Enter same passphrase again: [<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">Type</span> passphrase again] // 输入github的登录密码</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

4.生成完毕,验证一下SSH秘钥是否可用

<code class="language-Ruby hljs bash has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">eval</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$(ssh-agent -s)</span></span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

5.将SSH秘钥写入文件中

<code class="language-Ruby hljs ruby has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>ssh-add ~<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/.ssh/id</span>_rsa</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

6.现在id_rsa.pub文件中就已经存在了SSH,复制出来即可,方法上面有哦。 

文件上传


上传方式

  • Xcode上传
  • 终端命令行上传 

在GitHub中创建项目


点击+New repository并完成对项目的注解,Create repository即可 
完成对项目的注解 

这时也就会出现一个秘钥链接,通过这个链接完成对本地SSH秘钥的核对,从而完成上传,如图,这里就调皮了,使用的时候复制一下即可 
 

Xcode上传

1.完成代码后首先配置一下远程,配置位置如下: 
 

2.选择Remotes,左下角有一个+,接着Add Remote 

3.此时的Address就是之前创建项目的那个SSH链接,复制过来Add Remote就完工啦. 
 

4.每次提交前记得Commit一下,Xcode上的Commit也在Source Control中,意思是将修改的变化存到本地。下面可以写备注,比如修改了XX 
 

5.为了避免冲突,除了第一次上传,其他时候都要记得Pull一下,再点击Push.会弹出下面的框,验证方式选择SSH Keys即可 
 

6.再来看GitHub,上传成功! 
 

命令行上传

将项目文件拖到终端

1.添加远程

<code class="language-Ruby hljs oxygene has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//在终端输入命令行</span>
git remote <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">add</span> origin <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'SSH的那个链接'</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

2.Commit保存一下,“”里面随便填

<code class="language-Ruby hljs sql has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">git <span class="hljs-operator" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">commit</span> -m <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"第一次提交"</span></span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

3.Push上去即可

<code class="language-Ruby hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">git push <span class="hljs-attribute" style="box-sizing: border-box;">-u</span> origin master

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//如果代码,表示push完成</span>
RunIntoLoveMacBook<span class="hljs-attribute" style="box-sizing: border-box;">-Pro</span>:GitHubTest<span class="hljs-attribute" style="box-sizing: border-box;">-Terminal</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>xcodeproj yuewen$ git push <span class="hljs-attribute" style="box-sizing: border-box;">-u</span> origin master
Counting objects: <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9</span>, done<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
Delta compression using up <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">8</span> threads<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
Compressing objects: <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">%</span> (<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>/<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>), done<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
Writing objects: <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">%</span> (<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9</span>/<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9</span>), <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1.49</span> KiB <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">|</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">bytes</span>/s, done<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
Total <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9</span> (delta <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4</span>), reused <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span> (delta <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>)
<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">To</span> git@github<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>com:YRunIntoLove/GitHubTest<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>git
   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0610732.</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.90508</span>d7  master <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-> </span>master
Branch master <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">set</span> up <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> track remote branch master from origin<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>
RunIntoLoveMacBook<span class="hljs-attribute" style="box-sizing: border-box;">-Pro</span>:GitHubTest<span class="hljs-attribute" style="box-sizing: border-box;">-Terminal</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>xcodeproj yuewen$ </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li></ul>

4.再来看看GitHub,上传成功! 

发布了64 篇原创文章 · 获赞 10 · 访问量 6万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览