我在通過git訪問Gerrit上的外部存儲庫時遇到了問題。 當我嘗試蠢貨,克隆庫目錄獲取(克隆效果很好),我得到:git fetch in repo dir'Permission denied',but working with direct link with user
> git fetch
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
但是,當我直接與倉庫SSH地址和用戶名做,我得到:
> git fetch ssh://[email protected]:port/repo_name
remote: Counting objects: xxxx, done
remote: Finding sources: 100% (xxx/xxx)
etc...
所以直接git fetch似乎運作良好。 我試着設置不同的用戶名:
git config --global user.name "username"
,但沒有用 - 我仍然得到權限被拒絕(公鑰)。 再次 - git克隆工作正常。
任何想法如何解決這個問題?
謝謝!這爲我修好了。原始URL具有不同的用戶,因此我已將每個repo /.git/config文件中的值更改爲我的用戶名。 –