{"id":468,"date":"2012-10-01T16:03:38","date_gmt":"2012-10-01T07:03:38","guid":{"rendered":"http:\/\/blog.himor.in\/?p=468"},"modified":"2012-10-01T16:03:38","modified_gmt":"2012-10-01T07:03:38","slug":"using-multiple-ssh-key-to-access-gitolite","status":"publish","type":"post","link":"https:\/\/blog.himor.in\/?p=468","title":{"rendered":"using multiple ssh key to access gitolite"},"content":{"rendered":"<p><em>(This is my personal memo.. More beautiful solutions could be found on the web.)<\/em><\/p>\n<p>Using gitolite without adding oneself into @admin (or gitolite-admin), we need to use two keys (my own and one of gitolite account) for accessing gitolite repository. Even using ssh-agent (and only your own key added), specifying key for gitolite using &#8216;ssh:\/\/somehost-with-gitolite\/gitolite-admin&#8217; (and .ssh\/config) will work.<\/p>\n<blockquote><p>% git clone ssh:\/\/somehost-with-gitolite\/gitolite-admin<br \/>\nCloning into gitolite-admin&#8230;<br \/>\nremote: Counting objects: 48, done.<br \/>\nremote: Compressing objects: 100% (38\/38), done.<br \/>\nremote: Total 48 (delta 9), reused 0 (delta 0)<br \/>\nReceiving objects: 100% (48\/48), 5.24 KiB, done.<br \/>\nResolving deltas: 100% (9\/9), done.<\/p><\/blockquote>\n<p>On this server, I have two access: one with my own key (and user name &#8216;himorin&#8217;), another with gitolite admin key. And gitolite-admin is only accessible by gitolite key. Also for my local, I have added only my own key (like id_rsa) to ssh-agent, but not for gitolite key.<\/p>\n<p>After initial clone, when &#8216;git pull&#8217;, it does not work. And it seems git uses my own key (from command line output).<\/p>\n<blockquote><p>% git pull ssh:\/\/somehost-with-gitolite\/gitolite-admin<br \/>\nR access for gitolite-admin DENIED to himorin<br \/>\nfatal: The remote end hung up unexpectedly<\/p><\/blockquote>\n<p>Two solutions found on this: <\/p>\n<ul>\n<li>Simply adding my own key to gitolite-admin repo.<\/li>\n<li>Add gitolite key into ssh-add, or disable ssh-agent (or delete SSH_* ENV) on the shell<\/li>\n<\/ul>\n<p>Of course, .git\/config says<\/p>\n<blockquote><p>[remote &#8220;origin&#8221;]<br \/>\n        fetch = +refs\/heads\/*:refs\/remotes\/origin\/*<br \/>\n        url = ssh:\/\/somehost-with-gitolite\/gitolite-admin<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>(This is my personal memo.. More beautiful solutions could be found on the web.) Using gitolite without adding oneself into @admin (or gitolite-admin), we need to use two keys (my own and one of gitolite account) for accessing gitolite repository. Even using ssh-agent (and only your own key added), specifying key for gitolite using &#8216;ssh:\/\/somehost-with-gitolite\/gitolite-admin&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,3,14],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts\/468"}],"collection":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=468"}],"version-history":[{"count":1,"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts\/468\/revisions"}],"predecessor-version":[{"id":469,"href":"https:\/\/blog.himor.in\/index.php?rest_route=\/wp\/v2\/posts\/468\/revisions\/469"}],"wp:attachment":[{"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.himor.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}