Android使用git的http协议是无法上传Android源码,因为太大了 9G以上 修改了很多http nginx的限制还是上传不成功
修改过
git config --global http.postBuffer 2048576000 //改成2G都不行
服务端也修改过,如下:
调整Gitlab服务器配置
打开Gitlab服务器的配置文件/etc/gitlab/gitlab.rb。
修改gitlab_rails['max_attachment_size']的值为所需的文件大小限制,例如10M。
修改gitlab_rails['max_import_size']的值为所需的导入文件大小限制,例如20M。
修改nginx['client_max_body_size']的值为所需的客户端上传大小限制,例如30M。
保存并关闭配置文件。
重新启动Gitlab服务器,使配置生效。
还是不行。
使用过Git LFS(Large File Storage)也无法上传 总是报错:
error:RPC failed;curl 18 transfer closed with outstanding read data remaining
fatal:The remote end hung up unexpectedly
fatal:The remote end hung up unexpectedly
或者
error:RPC failed;HTTP 413 curl 22 The requested URL returned errors:413 Request Entity Too Large
fatal:The remote end hung up unexpectedly
fatal:The remote end hung up unexpectedly
最终使用ssh上传成功
配置ssh
1、生成密钥
root@5b7d81d98696:/# ssh-keygen -t rsa -b 4096 -C "xingchun@meiktv.com"
按三个回车
root@5b7d81d98696:/# ssh-keygen -t rsa -b 4096 -C "xingchun@meiktv.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:vikKdd94fd0fvQnwLdKFTUMKKqqbFRkVfeA3RM/zomU xingchun@meiktv.com
The key's randomart image is:
+---[RSA 4096]----+
| oo.o+ . |
| . ..o.+ o |
| . . o.o = o |
| + . . . * .|
| .+. S . E + |
| ....o o .B +.o|
| .. . + oo.=.o+|
| .+ . + ..o =|
| o.. .o o.|
+----[SHA256]-----+
root@5b7d81d98696:/#
2、复制公钥到git账户下
查看公钥
root@5b7d81d98696:/# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8JOWJPavJ4wOMTmu52D113qg8BjZPwR8D864CJHYBnIxRB5G1YDht5jpT9KXsavzRm4+7uwA/K/7RHDTFa23KIouwNeKoNxAviTMAevMdTPJQaVoDQk+KbG/nBwOU+1R7LyfP+PZxsMm4byBE0GaXCeDqQ+/kScKCcjuHsFKDmdovKqfeBWw3ejOEBG+EsYcHhNTK0uhN/NaI5czNCDp210QYwU0RWsU2qjPxNEbkaXcSnB8Zng/o6eNhYiampgKpuirLf+orvxbda/U3LZgQ0wyHMfD4ePqKK2iZLbjW97WUYkHl2TqsR6lMXM1NTP8lvi78n3rKHl/lbkD2IJsKH3QfbQTwA6oN8PXiifGr41dZbip/eFRjWpnbrRnDQcipaJ/IP0pmbCVEfHCeBLwIPJzjLeIkSAM0wYOwkCsOJkqsAlwg99bJ7dwBf3y9BdTJ7p09Mu8sGBmldETIvZa91mDZ+1hOZhncDvwfYNprAUrQk6Dy66t0vVo2LwkjsxLcrQrP0Re8AyQXVEFke/xktpB0PjU+FdIyZaD0SKMeOgp+NdrURrqXZxQV8kG7UXJMp9udyrvRfh1c6RjUjeVGx52jbqM5N/7i6W5vmo3wRfa8HUrIryucgA7VS6Ws5gprH42bL3RufnOxNaQcHIWLeiwhYH1hgrc3YhpJPAZwDQ== xingchun@meiktv.com
root@5b7d81d98696:/#
复制以上公钥到git账号下:
企业微信截图_16953674892843.png 企业微信截图_16953675627803.png
配置完成
ssh默认端口是22,后端可能会更改端口,如果后端改了端口,客户端也需要改成对应端口:
修改端口如下:
查看端口: 端口信息保存在 ~/.ssh/config文件下,先查看此文件是否存在,一般不存在。创建一个文件
root@5b7d81d98696:/# cat ~/.ssh/config
cat: /root/.ssh/config: No such file or directory
root@5b7d81d98696:/# touch ~/.ssh/config
root@5b7d81d98696:/# vim ~/.ssh/config
vim 打开文件 按i键进入编辑模式
输入:
Host xxx.xxx.com
HostName xxx.xxx.com
Port 22
``
按Esc 然后:wq退出保存
cat 再次查看确认:
root@5b7d81d98696:/# cat ~/.ssh/config
Host xxx.xxx.com
HostName xxx.xxx.com
Port 22
到源码目录上传:
git init
git add .
git commit -m "first commit"
git config --global user.email "xxx@xxx.com"
git config --global user.name "xxx"
git remote add origin git@xxx.git
git branch -M master
git push -uf origin master
网友评论