**********1.在运行git push origin master指令时报例如以下错误:
iluckysi@ILUCKYSI-PC /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进行改动.
iluckysi@ILUCKYSI-PC /d/ilucky/message/code (master)
$ git config --global http.postbuffer 24288000 iluckysi@ILUCKYSI-PC /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/* iluckysi@ILUCKYSI-PC /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.
iluckysi@ILUCKYSI-PC /d/ilucky/message/code (master)
$ git remote set-url origin [email protected]:IluckySi/message.git
iluckysi@ILUCKYSI-PC /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.
iluckysi@ILUCKYSI-PC /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): 输入githubpassword
Enter same passphrase again: 输入githubpassword
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+.. |
| *..* |
| ..**.+ |
+-----------------+ iluckysi@ILUCKYSI-PC /d/ilucky/message/code (master)
生成key后,在/c/Users/用户/文件夹下会生成一个.ssh文件夹,将.ssh文件夹下id_rsa.pub文件里的内容
依照例如以下图片加入到github中,加入完毕后,再次运行指令,ok,成功了!
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
$ 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 iluckysi@ILUCKYSI-PC /d/ilucky/message/code (master)
$ 问题:https,ssh和svn的差别?官方建议使用https.
參考http://stackoverflow.com/questions/11041729/why-does-github-recommend-https-vs-ssh **********2.加入协作开发人员.
依照git例如以下图片加入协作开发人员.
注意:协作开发人员也要有自己的GitHub账户,本地的GitHub工作空间.
协作开发人员通过指令将管理员的项目clone一份,clone的url是管理员GitHub上的项目url.
这样协作开发人员就能够在自己的工作空间对项目进行各种操作了. 除了上面的合作方式,另一种合作方式:通过fork和pull request.
依照例如以下图片将管理员的项目fork一下,即将管理员的项目打一个分支到自己的GitHub上
然后将自己GitHub上的项目clone一份到本地的工作空间,这样就能够对项目进行各种操作了,这里的操作不会影响到
管理员GitHub上的项目.假设有一天自己的任务完毕了,能够通过发一个pull request与管理员分享,
假设管理员觉得没有问题,能够进行merge,假设觉得有问题,能够进行讨论. 參考http://tech.marsw.tw/blog/2013/08/17/git-notes-github-n-person-cooperation-settings/ **********3.忽略某些文件提交.
通过例如以下指令,在git资源库文件夹下生成.gitnore文件.
iluckysi@ILUCKYSI-PC /d/ilucky/message/code (master)
$ touch .gitignore
然后在.gitnore文件夹下配置忽略的文件,例如以下:
message-web/test/*
message-web/target/*
message-web/bin/*
message-web/src/main/resources/message.properties
忽略某些文件提交的目的有两个:
1.对于一些二进制数据没有必要进行提交.
2.对于一些敏感信息,比如数据库连接信息等不能进行提交. **********4.在GitHub上删除资源库.