1. 程式人生 > >linux下安裝git常見故障整理

linux下安裝git常見故障整理

git常見故障

FAQ


1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

[root@testss git]# git clone [email protected]:testone.git
正克隆到 'testone'...
[email protected]'s password: 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


解決辦法:-C是用戶名

[root@testss git]# ssh-keygen -t rsa -C "git"

[root@testss git]# cat /root/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwhn+ejPkZY ***省略

[root@testss git]# cat /root/.ssh/id_rsa.pub > /home/git/.ssh/authorized_keys



2: fatal: The remote end hung up unexpectedly

fatal: Couldn't find remote ref master

解決辦法:如圖

技術分享圖片

[http]

postBuffer = 524288000



3: 如果輸入$ git push origin master,提示出錯信息:error:failed to push som refs to .......

解決辦法如下:

  • 1、先輸入$ git pull origin master //先把遠程服務器github上面的文件拉下來

  • 2、再輸入$ git push origin master

  • 3、如果出現報錯 fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal: Could not read from remote repository.

  • 4、則需要重新輸入$ git remote add origin [email protected]:djqiang/gitdemo.git


4:使用git init創建了一個倉庫。再git clone到其他位置,在clone的倉庫使用git push的時候出現“receive.denyCurrentBranch' configuration variable to 'refuse'.To IP-ADDR :testone.git”

// 命令行 $ git --bare init --shared

技術分享圖片


5: error: src refspec master does not match any.

$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to '[email protected]:testone/test.git'

本地版本庫為空,不能提交

解決辦法

$ git add hello		//提交一個文件
$ git commit -m "first commit"    //註釋


6: remote: error: insufficient permission for adding an object to repository database ./objects

// 原因分析: 因為test.git 目錄權限寫入失敗

remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: remote unpack failed: unpack-objects abnormal exit
To 192.168.9.19:testone/test.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '[email protected]:testone/test.git'


//解決辦法: 將test.git目錄設置成git.git 屬主屬組權限 再次上傳成功


linux下安裝git常見故障整理