| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
kktd1608
7年前发布

GitHub 使用

   <p>GitHub 是一个面向开源及私有软件项目的托管平台,因为只支持 Git 作为唯一的版本库格式进行托管,故名 GitHub——来自百度百科</p>    <h2><strong>主要作用</strong></h2>    <ul>     <li>学习优秀开源项目</li>     <li>团队协作</li>     <li>基于 GitHub Pages 来搭建个人博客</li>     <li>写作</li>    </ul>    <h2><strong>注册</strong></h2>    <p>点击Sign up,填写相关信息</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/76a99ac0d5d95514fefda6d5fbdf22c9.jpg"></p>    <p>注意:用户名建议取正式点,如果你以后想基于GitHub 搭建博客,默认给你生成的博客地址就是 <a href="/misc/goto?guid=4959727539491775335" rel="nofollow,noindex">http://username.github.io</a></p>    <h2><strong>登录</strong></h2>    <p>点击Sign in,登录成功,点击头像里的your profile进入我的主界面</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/249e001c4589cbe699e9aadaaaf1711c.jpg"></p>    <h2><strong>创建项目</strong></h2>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/c7e3caf79c4ba48e2fe0228639b28c1a.jpg"></p>    <ul>     <li>Private选项针对企业,收费的,我们个人只能Public,创建的项目,全世界都能看到</li>     <li>可以勾上Initialize this repository with a README,对项目有个介绍</li>    </ul>    <h2><strong>git学习</strong></h2>    <p>先了解下git知识,克隆项目和提交代码需要。</p>    <p>1、下载: <a href="/misc/goto?guid=4958974485080634130" rel="nofollow,noindex">https://git-for-windows.github.io/</a></p>    <p>2、命令行</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/07f589dac7a88e1ce19b2cc3f76a6e1e.jpg"></p>    <p>3、设置账号</p>    <p>git config –global user.name “Your Name”</p>    <p>git config –global user.email “email@example.com”</p>    <p>这步是要告诉github,谁提交了代码</p>    <p>4、查看配置信息</p>    <p>要检查已有的配置信息,可以使用 git config –list 命令:</p>    <p>git config –list</p>    <h2><strong>克隆项目</strong></h2>    <p>有GitHub后,可以自由的 clone 或者下载其他项目,命令行:</p>    <p>git clone <a href="/misc/goto?guid=4959727539612536270" rel="nofollow,noindex">https://github.com/WuXiaolong/WeWin.git</a></p>    <p>其中 <a href="/misc/goto?guid=4959727539612536270" rel="nofollow,noindex">https://github.com/WuXiaolong/WeWin.git</a> 就是项目的github地址:</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/54143a35775d93199a13142a16104bd3.jpg"></p>    <h2><strong>SSH Key</strong></h2>    <p>github提交代码需要SSH授权,不然可以随便提交代码了</p>    <p>1、创建SSH Key</p>    <p>命令行:</p>    <p>ssh-keygen -t rsa -C “youremail@example.com”</p>    <p>你需要把邮件地址换成你自己的邮件地址,然后一路回车,使用默认值即可。</p>    <p>如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,</p>    <p>这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥。</p>    <p>2、设置GitHub</p>    <p>登陆GitHub,打开“Account settings”,“GitHub”页面</p>    <p>点“Add SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容:</p>    <h2><strong>提交代码</strong></h2>    <h2><strong>本地提交</strong></h2>    <p>使用命令</p>    <p>git add README.md</p>    <p>git commit -m “first commit”</p>    <h2><strong>关联远程库</strong></h2>    <p>使用命令</p>    <p>git remote add origin <a href="/misc/goto?guid=4959727539612536270" rel="nofollow,noindex">https://github.com/WuXiaolong/WeWin.git</a></p>    <h2><strong>推送代码</strong></h2>    <p>使用命令</p>    <p>git push origin master</p>    <h2><strong>可视化工具</strong></h2>    <p>如果不想使用命令行,可以使用:</p>    <p>GitHub Desktop: <a href="/misc/goto?guid=4958965631600325617" rel="nofollow,noindex">https://desktop.github.com/</a> 只能提交github</p>    <p>tortoisegit: <a href="/misc/goto?guid=4959645702987353176" rel="nofollow,noindex">https://tortoisegit.org/</a></p>    <p>SourceTree: <a href="/misc/goto?guid=4958971603591109535" rel="nofollow,noindex">https://www.sourcetreeapp.com/</a></p>    <h2><strong>Android studio与github</strong></h2>    <p>Android studio已经集成了github</p>    <h2><strong>配置github账号</strong></h2>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/acf3fb3bd71bb4f25c89730ecbe68197.jpg"></p>    <h2><strong>配置git</strong></h2>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/f4b1b2255da4f1d9329185ac7b0a950d.jpg"></p>    <p>可以点击Test,检测下是否成功</p>    <h2><strong>导入项目</strong></h2>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/eca15a62fa6df931222ef73e2f0272a7.jpg"> <img src="https://simg.open-open.com/show/3ef3828beac470d29941c87b8205a517.jpg"></p>    <h2><strong>提交代码</strong></h2>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/aa86a543a58a35632a53a6ca3baf16d2.jpg"></p>    <p>真实项目中,一般先pull,反正冲突,然后add、commit提交,再push推送。</p>    <h2><strong>其他</strong></h2>    <h2><strong>Issue</strong></h2>    <p>问题的意思,比如你发现某个开源项目有bug,你可以提Issue给作者,作者可以修复bug,修复完毕可以一个个 Close 掉。图为新建Issue:</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/1d72b874a929c254c20fbb18b3e2fe68.jpg"></p>    <h2><strong>Pull request</strong></h2>    <p>发起请求,这个其实是基于 Fork 的,比如你Fork别人项目,你修改,想提交给原作者,可以通过Pull Request方式,原作者觉得你的代码没问题,选择Merge pull request,合并你的提交的代码。图为新建Pull request:</p>    <p style="text-align: center;"><img src="https://simg.open-open.com/show/eb1b16f9f386d87a95e7355ebe77357f.jpg"></p>    <p> </p>    <p>来自:http://wuxiaolong.me/2016/11/29/githubGuide/</p>    <p> </p>    
 本文由用户 kktd1608 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1480577054691.html
Git Github