</pre><pre name="code" class="java">**********1.在执行git push origin master指令时报如下错误: [email protected] /d/ilucky/message/code (master) $ git push origin master Username for 'https://github.com': IluckySi Password for 'https://[email protected]': Counting objects: 178, done. Delta compression using up to 4 threads. Compressing objects: 100% (100/100), done. eWfrror: RPC failed; result=56, HTTP code = 200 KiB/s atal: The remote end hung up unexpectedly Writing objects: 100% (123/123), 5.30 MiB | 13.00 KiB/s, done. Total 123 (delta 49), reused 0 (delta 0) fatal: The remote end hung up unexpectedly Everything up-to-date 问题:eWfrror: RPC failed; result=56, HTTP code = 200 KiB/s 经上网查询,原因是http.postbuffer值较小,对postBuffer进行修改. [email protected] /d/ilucky/message/code (master) $ git config --global http.postbuffer 24288000 [email protected] /d/ilucky/message/code (master) $ git config --list core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true user.name=sidongxue [email protected] http.postbuffer=24288000 //修改后的http.postbuffer core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.symlinks=false core.ignorecase=true core.hidedotfiles=dotGitOnly remote.orgin.url=https://github.com/IluckySi/message.git remote.orgin.fetch=+refs/heads/*:refs/remotes/orgin/* remote.origin.url=https://github.com/IluckySi/message.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* [email protected] /d/ilucky/message/code (master) $ git push origin master Username for 'https://github.com': IluckySi Password for 'https://[email protected]': Counting objects: 178, done. Delta compression using up to 4 threads. Compressing objects: 100% (100/100), done. Writing objects: 100% (123/123), 5.30 MiB | 0 bytes/s, done. Total 123 (delta 49), reused 0 (delta 0) 配置完后,继续执行git push origin master指令,依然有问题,再次上网进行查询,经网上建议可以将https方式改为ssh方式. 登录Github发现reomte的url有三种连接方式:https,ssh和svn,git连接github默认使用https. [email protected] /d/ilucky/message/code (master) $ git remote set-url origin [email protected]:IluckySi/message.git [email protected] /d/ilucky/message/code (master) $ git push origin master Received disconnect from 192.30.252.129: 11: Bye Bye fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 修改完后,继续执行git push origin master指令,还是有问题,再次上网进行查询, 原来通过ssh连接github需要通过key. [email protected] /d/ilucky/message/code (master) $ ssh-keygen -t rsa -C "[email protected]" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/zhangmengjiao/.ssh/id_rsa): /c/Users/zhangmengjiao/.ssh/id_rsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): 输入github密码 Enter same passphrase again: 输入github密码 Your identification has been saved in /c/Users/zhangmengjiao/.ssh/id_rsa. Your public key has been saved in /c/Users/zhangmengjiao/.ssh/id_rsa.pub. The key fingerprint is: ce:eb:cd:8e:5e:80:e9:3b:d6:f8:c2:75:63:d2:28:0d [email protected] The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | Eo | | ooSo | | ..o=.= | | ..=o+.. | | *..* | | ..**.+ | +-----------------+ [email protected] /d/ilucky/message/code (master) 生成key后,在/c/Users/用户/目录下会生成一个.ssh目录,将.ssh目录下id_rsa.pub文件中的内容 按照git整理2-1图片添加到github中,添加完成后,再次执行指令,ok,成功了! $ git push origin master Enter passphrase for key '/c/Users/zhangmengjiao/.ssh/id_rsa': Counting objects: 178, done. Delta compression using up to 4 threads. Compressing objects: 100% (100/100), done. Writing objects: 100% (123/123), 5.30 MiB | 44.00 KiB/s, done. Total 123 (delta 49), reused 0 (delta 0) To [email protected]:IluckySi/message.git 8dae8c8..f6dc5b2 master -> master [email protected] /d/ilucky/message/code (master) $ ??????????问题:https,ssh和svn的区别?官方建议使用https. 参考http://stackoverflow.com/questions/11041729/why-does-github-recommend-https-vs-ssh **********2.添加协作开发者. 按照git整理2-2图片添加协作开发者. 注意:协作开发者也要有自己的GitHub账户,本地的GitHub工作空间. 协作协作开发者通过指令将管理员的项目clone一份,clone的url是管理员的项目url. 这样协作开发者就可以在自己的工作空间对项目进行各种操作了. 除了上面的合作方式,还有一种合作方式:通过fork和pull request. 按照git整理2-3图片将管理员的项目fork一下,即将管理员的项目打一个分支到自己的GitHub上, 然后将自己GitHub上的项目clone一份到本地的工作空间,这样就可以对项目进行各种操作了,这里的操作不会影响到 管理员GitHub上的项目.如果有一天自己的任务完成了,可以通过发一个pull request与管理员分享, 如果管理员认为没有问题,可以进行merge,如果觉得有问题,可以进行讨论. 参考http://tech.marsw.tw/blog/2013/08/17/git-notes-github-n-person-cooperation-settings/
时间: 2024-10-10 18:25:59