git & github -- 曾經遇到的問題的記錄

git github 相信大家都很熟悉,在使用的過程中難免會出現一些問題,更何況我這樣的經常換設備以及虛擬機的用戶,經常會遇到git的各種問題,下面簡單記錄一下曾經出現過的問題以及解決的方法,可能部分解決的方法不是很正規,但是不管怎麼說在本人的環境下都能迴歸到正常狀態,所以,請不要打擊我們小白的學習的勁頭^_^。

一、在進行git clone的時候,出現如下所示的問題

Cloneing into 'xxxx'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

解決方案:

1、使用指令測試一下githubssh是否配置成功, -T不顯示終端,只顯示連接成功信息

$ ssh -T [email protected]

輸出:
[email protected]: Permission denied (publickey).

2、配置一下用戶名和郵箱

$ git config --global user.name "username"
$ git config --global user.email "[email protected]"

3、此時可以嘗試一下git clone指令,本人測試實際效果還是和之前的問題是一致的,所以,繼續往下操作

$ ssh -v [email protected]

 

找到他嘗試的.ssh的路徑是這個路勁,然後好奇看了一下這個文件夾下有什麼文件

天啦,裏面竟然沒有id_rsa和id_rsa.pub文件,在查找一下這個文件,用Everything工具查找一下

然後將包含id_rsa的這個.ssh的這個文件夾直接替換那個沒有id_rsa的文件,然後在測試

然後再進行clone操作

完成,之後的git push pull等操作均可以正常運行。

二、git clone出現下面的問題

Cloneing into 'xxxx'...
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

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

解決方案:

1、使用指令測試連接

$ ssh -T [email protected]

輸出:
sign_and_send_pubkey: signing failed: agent refused operation

Permission denied (publickey).

2、設置用戶名和郵箱

$ git config --global user.name "username"
$ git config --global user.email "[email protected]"

3、將SSH Key添加到ssh-agent

$ ssh-agent -s

輸出:

SSH_AUTH_SOCK=/tmp/ssh-5JYIIgdzHvTM/agent.34213; export SSH_AUTH_SOCK;
SSH_AGENT_PID=34214; export SSH_AGENT_PID;
echo Agent pid 34214;

4、使用指令 ssh-add 將專用密鑰添加到ssh-agent的高速緩存中,默認路勁

$ ssh-add
輸出:
Identity added: /home/yourname/.ssh/id_rsa (/home/yourname/.ssh/id_rsa)

4、再次測試連接

$ ssh -T [email protected]
輸出:
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

5、然後在進行git clone,即可成功,後續操作也沒有任何問題。

三、git clone 出現輸入密碼,並且然後Permission Denied (publickey)問題

解決方案:

可知先直接使用ssh-add ~/.ssh/id_rsa把專用密鑰(private and public keys)添加到 ssh-agent 的高速緩存中

其中 ~/.ssh/id_rsa 的根據個人不同做適當的更改

如果還是不好用,則可以按照下面的步驟繼續進行。

1、設置用戶名和郵箱

$ git config --global user.name "username"
$ git config --global user.email "[email protected]"

2、創建一個 SSH key

ssh-keygen -t rsa -C "[email protected]"

如果之前已經存在ssh key,那麼會提示是否進行覆蓋,此處輸入 y

3、把專用密鑰(private and public keys)添加到 ssh-agent 的高速緩存中

$ ssh-add ~/.ssh/id_rsa

然後即可正常進行clone

四、git clone 出現

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

詳看大佬博客解決。電梯直達大佬方案

五、git bash 使用出現問題:

WARNING: terminal is not fully functional

- (press RETURN)

在關閉終端的時候,出現:

解決方案:

1、創建環境變量,注意大寫哦,我就是在沒有區分大小寫的時候,折騰好久。

2、在終端選項中設置 終端類型 爲 xterm

六、在 ssh-add 時候出現 Could not open a connection to your authentication agent.

經查,都在說明是以哦那個指令 ssh-agent bash 即可解決問題,但是本人並未有效。

解決方案:

在使用上面指令沒有效果之後,直接重新生成key,由於本地還有其他的ssh key的原因,此時設置的時候沒有使用默認的設置

$ ssh-keygen -t rsa -C "[email protected]" # 郵箱使用自己的

$ ssh-add ~/.ssh/id_rsa_song
Identity added: /home/ma-sai-ke/.ssh/id_rsa_song (/home/ma-sai-ke/.ssh/id_rsa_song)

七、在windows中git bsah下進行git clone;然後報錯

$ git clone [email protected]:sxxxxxxxg/nxxxxxxxxxc.git

Cloning into 'nxxxxxxxxxc'...

Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.

解決辦法:

C:\Users\用戶名\.ssh\下新建一個文件 config,注意沒有後綴,並在文件中寫入 LogLevel=quiet,保存退出。再次執行 git clone即可正常。

八、在windows中git bsah下進行git clone;然後報錯

$ git clone  [email protected]:sxxxxxxxg/Soxxxxxxr.git
Cloning into 'Soxxxxxxr'...
fatal: Could not read from remote repository.

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

不要慌,這個錯誤你只需要確保在遠程倉庫正確的情況下,檢查網絡然後重試基本就可以了。

九、在windows中git bsah下進行git clone;然後報錯

$ git clone  [email protected]:sxxxxxxg/Soxxxxxxxer.git
Cloning into 'Soxxxxxxxer'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
fatal: the remote end hung up unexpectedly | 0 bytes/s
fatal: early EOF
fatal: index-pack failed

對的,還是網絡的問題。

持續更新......

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章