ssh 協議執行repo sync 報錯:Permission denied (publickey)


1、ssh key

  已經添加ssh key到gerrit服務器,並且執行ssh協議的git clone可以正常克隆代碼到本地,可見不是ssh key的問題。

2、manifest清單文件配置

  最初在manifest清單文件中配置:

  <remote name="origin" fetch="ssh://git@ip:29418"/>

  或者:

  <remote name="origin" fetch="ssh://ip:29418"/>

3、出現問題

  在客戶端執行repo init -u http://ip/manifest --repo-url http://ip/repo ,運行正常。

  但是執行repo sync后,報錯:

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


4、解決方法

  修改manifest文件的fetch元素:


  <remote name="origin" fetch=".."/>

".." 意思是fetch的url和repo init時manifest的url對應。


因為ssh的url需要包含用戶名,而客戶端用戶各不相同,因此這里用".."與manifest相對應,實現正常訪問。



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM