場景:git
在進行git push代碼到oschina的時候,因爲使用http的方式,致使提交大文件時提示錯誤。app
具體錯誤:dom
Counting objects: 381162, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (110691/110691), done.
error: RPC failed; result=22, HTTP code = 413 MiB | 1.92 MiB/s
fatal: The remote end hung up unexpectedly
Writing objects: 100% (381162/381162), 611.66 MiB | 15.39 MiB/s, done.
Total 381162 (delta 262226), reused 381087 (delta 262153)
fatal: The remote end hung up unexpectedly
Everything up-to-date
ssh
Counting objects: 381162, done. Delta compression using up to 4 threads. Compressing objects: 100% (110691/110691), done. error: RPC failed; result=22, HTTP code = 413 MiB | 1.92 MiB/s fatal: The remote end hung up unexpectedly Writing objects: 100% (381162/381162), 611.66 MiB | 15.39 MiB/s, done. Total 381162 (delta 262226), reused 381087 (delta 262153) fatal: The remote end hung up unexpectedly
這個錯誤是因爲傳輸的文件過大致使https報的錯誤,修改成ssh傳輸就能夠了ide
git remote set-url origin git@git.oschina.net:xxx/example.git
還須要生成一個ssh-key,具體參見個人博客:工做中常用到的Git命令url
edustack@Eucalyptus:/edx/app/edxapp/edx-platform$ ssh-keygen -t rsa -C "xxxxxx@example.com" Generating public/private rsa key pair. Enter file in which to save the key (/home/edustack/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/edustack/.ssh/id_rsa. Your public key has been saved in /home/edustack/.ssh/id_rsa.pub. The key fingerprint is: 05:9c:a6:f5:2c:e8:50:7a:a0:3c:eb:b0:bc:95:7f:52 liuyuantao1990@gmail.com The key's randomart image is: +--[ RSA 2048]----+ | ... | | . . =. | | . . + = o. | | + o + ..o | | o + S. | |. . . .E | |.+ o . | |..o .. . | | .. .o | +-----------------+
把生成的ssh-key添加到oschina的帳戶裏.net
而後push就能夠了code