1. 程式人生 > >【Git】It is also possible that a host key has just been changed. The fingerprint for the ECDSA key解決

【Git】It is also possible that a host key has just been changed. The fingerprint for the ECDSA key解決

今天提交程式碼,pull的時候.出現IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!

的錯誤資訊.

root@ubuntu:/home/python/Desktop/xxx/xxx/xxx# git pull origin dev
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:u6OmG6qR+1
QBAdu32XELsrwwva30N0VBFrGEFTZN+0E. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:2 remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R 172.xx.x.xxx ECDSA host key for 172.xx.x.xxx has changed and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
.

正好在提交前,聽到了老大和一個同事聊天,大概就是因為git伺服器重做了系統,所以key不一樣了,需要重新弄一個.

執行一下刪除key:

rm -f  /root/.ssh/known_hosts 
root@ubuntu:/home/python/Desktop/xxx/xxx/xxx# git pull origin dev
The authenticity of host '172.xx.x.xxx (172.xx.x.xxx)' can't be established.
ECDSA key fingerprint is SHA256:u6OmG6qR+1QBAdu32XELsrwwva30N0VBFrGEFTZN+0E.
Are you sure you want to continue connecting (yes/no)? yes # 這裡yes
Warning: Permanently added '172.xx.x.xxx' (ECDSA) to the list of known hosts.   
[email protected]'s password: 

讓輸入密碼了,估計是可以了..
pull是可以了,push又不行了….

root@ubuntu:/home/python/Desktop/osgds/Operation/opsapp# git push origin dev
rd@172.xx.x.xxx's password: 
物件計數中: 10, 完成.
Delta compression using up to 2 threads.
壓縮物件中: 100% (10/10), 完成.
寫入物件中: 100% (10/10), 2.66 KiB | 0 bytes/s, 完成.
Total 10 (delta 7), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To [email protected]:/git/xx.git
 ! [remote rejected] dev -> dev (unpacker error)
error: 無法推送一些引用到 'rd@172.xx.x.xxx:/git/xx.git'

百度了下,說是許可權問題..給老大說了一聲,他估計是改了下設定,可以正常提交了.