且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

git clone git @ myserver:gitolite-admin失败

更新时间:2022-12-01 07:49:34

gitolite-admin is only accessible with the public key named after the git account used for the gitolite server.

You are using by default your brian.pub, which only gives you access to testing.git repo.

you need to define a $HOME/.ssh/config file on your local workstation, in order to record ssh parameters to use the right key.
See "gitolite: can connect via ssh, can't clone".

~/.ssh/gitolite.pub
~/.ssh/gitolite

Then I define a config file: ~/.ssh/config with in it:

host gitolite
     user git # replace it by the actual git user for the gitolite server
     hostname server.com
     identityfile ~/.ssh/gitolite

The clone will work:

git clone gitolite:gitolite-admin


The OP macbert confirms:

I did rename the key to git.pub, ran gitolite setup -pk git.pub and removed the old brian key from the .gitolite/keydir.
After that I got git clone git@myserver:gitolite-admin:

Cloning into 'gitolite-admin'... 
remote: Counting objects: 15, done. 
remote: Compressing objects: 100% (12/12), done. 
remote: Total 15 (delta 0), reused 0 (delta 0) 
Receiving objects: 100% (15/15), done.

So with the right default key, a ssh git@myserver info should this time display the right access for gitolite-admin repo in the 'hello' message.