使用https方式拉取的git倉庫,在push文件時(shí)報(bào)錯(cuò)Gitlab error push files 413 Request Entity Too Large吕朵,因?yàn)橥扑偷奈募^了1G扭仁,在stackoverflow上找解決辦法致稀,嘗試了如下幾個(gè)都不行
1. 增大https方式的post緩存
git config http.postBuffer 524288000
2. 直接使用-u參數(shù)
git push -u origin develop
于是嘗試使用ssh方式【可行】宗苍,步驟如下:
1. 修改本地倉庫的https方式為ssh
git remote set-url origin git@github.com:[user_name]/[project_name].git
其中本地倉庫的https地址可以使用git remote -v 查看钻弄,本倉庫的ssh地址可以在遠(yuǎn)程的倉庫頁面點(diǎn)開clone按鈕查看
此時(shí)直接push會(huì)提示輸入git@repos.git的密碼佃却,這是因?yàn)楸镜貨]有創(chuàng)建ssh密鑰,進(jìn)行第二步
2. 生成ssh密鑰
cd ~/.ssh
如果沒有.ssh目錄則創(chuàng)建
ssh-keygen -t rsa -C 'yourmail@qq.com'
將id_rsa.pub中的密鑰copy到遠(yuǎn)程倉庫用戶信息中(編輯用戶信息窘俺,增加一個(gè)ssh密鑰饲帅,在用戶設(shè)置 SSH Keys中)
3. 如果使用SourceTree拉取時(shí)總是提示輸入密碼,則需要在“工具”-“選項(xiàng)”-“一般”批销,配置上SSH秘鑰
4. 如果使用git bash拉取代碼總是需要輸入密碼則可以使用命令設(shè)置用戶名和郵箱信息并保存密碼
git config --global credential.helper store
git config --global user.name? "name"?
git config --global user.email? "name@mail.com"
參考:
git - Github Push Error: RPC failed; result=22, HTTP code = 413 - Stack Overflow
git - Gitlab error push files 413 Request Entity Too Large - Stack Overflow
git ssh配置洒闸、密鑰創(chuàng)建
SourceTree克隆倉庫時(shí),總是提示輸入密碼
向github提交代碼是老要輸入用戶名密碼