{"id":873,"date":"2025-05-25T04:53:05","date_gmt":"2025-05-25T02:53:05","guid":{"rendered":"https:\/\/chauquest.com\/?p=873"},"modified":"2025-05-25T04:53:52","modified_gmt":"2025-05-25T02:53:52","slug":"how-to-use-keepassxc-ssh-agent-with-git","status":"publish","type":"post","link":"https:\/\/chauquest.com\/index.php\/micro-tips\/how-to-use-keepassxc-ssh-agent-with-git\/","title":{"rendered":"How to use KeepassXC ssh-agent with Git"},"content":{"rendered":"<div class=\"wp-block-post-excerpt\"><p class=\"wp-block-post-excerpt__excerpt\">I was fed up to always type my passphrase when using git. I show you what modification you need to do in order to use the auto ssh-agent offered with KeepassXC.<\/p><p class=\"wp-block-post-excerpt__more-text\"><a class=\"wp-block-post-excerpt__more-link\" href=\"https:\/\/chauquest.com\/index.php\/micro-tips\/how-to-use-keepassxc-ssh-agent-with-git\/\"><br><\/a><\/p><\/div>\n\n\n<p>First why KeepassXC ? In my point of view it is a far superior alternative to Keepass original client:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>multi-platform<\/strong> : Linux, Windows, MacOS <\/li>\n\n\n\n<li><strong>Easy synchronization<\/strong> through any cloud services (Nextcloud Included)<\/li>\n\n\n\n<li><strong>WebIntegration <\/strong>in firefox and other browser<\/li>\n\n\n\n<li><strong>SSH agent <\/strong>automatic setup<\/li>\n<\/ul>\n\n\n\n<p>Today we will mainly focus on the last point ! How to setup the SSH-agent in order to use it directly in GIT. It seems straightforward but actually, it is fairly buggy and need some annoying trick.<\/p>\n\n\n\n<p>It is well better to setup a <strong>passphrase <\/strong>with your ssh key because in the case your private key get stolen nobody can use it without your passphrase, however it is really annoying to <strong>input the passphrase all the time.<\/strong> <strong>KeepassXC <\/strong>provide you with a tool that setup <strong>ssh-agent automatically<\/strong> when you <strong>unlock database.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">KeepassXC setup<\/h2>\n\n\n\n<p>Mainly need to change some settings and to setup the entry that will contain the SSH-agent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Settings <\/h3>\n\n\n\n<p>in <code>Tools\/settings<\/code> search the <strong><em>SSH Agent<\/em><\/strong> tab. here you should only tick the <strong><em>Enable SSH Agent Integration<\/em><\/strong> and <strong><em>Use OpenSSH<\/em><\/strong>. Everything should directly be fine.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69d0d8f554f4a&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large is-resized wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-3-1024x551.png\" alt=\"\" class=\"wp-image-877\" style=\"width:600px\" srcset=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-3-1024x551.png 1024w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-3-300x161.png 300w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-3-768x413.png 768w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-3.png 1465w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">SSH Agent setting tab<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Entry setup<\/h3>\n\n\n\n<p>First in KeepassXC you need to create a new entry were you are going to paste the passphrase in the <em>password field<\/em>.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69d0d8f555647&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large is-resized wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1024x551.png\" alt=\"\" class=\"wp-image-874\" style=\"aspect-ratio:1.8584463483570985;object-fit:cover;width:600px\" srcset=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1024x551.png 1024w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-300x161.png 300w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-768x413.png 768w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image.png 1465w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">Classical setup<\/figcaption><\/figure>\n\n\n\n<p>Now from the icon in the left you are going to search <strong>Advanced<\/strong> and add your private key as attachments. <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\">(This step is not mandatory please read the disclaimer above)<\/mark><\/strong><\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69d0d8f555c22&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large is-resized wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1-1024x551.png\" alt=\"\" class=\"wp-image-875\" style=\"aspect-ratio:1.8591668926929275;object-fit:cover;width:600px\" srcset=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1-1024x551.png 1024w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1-300x161.png 300w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1-768x413.png 768w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-1.png 1465w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">Private key as attachment<\/figcaption><\/figure>\n\n\n\n<p>Final step, go into the <strong>SSH agent <\/strong>tab and select your attachment and tick what option you prefer for SSH agent. <em>(for some key like this one I activate both automatic add and remove)<\/em>. <em>You can check if everything is working by clicking on <strong>Decrypt<\/strong><\/em><\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69d0d8f556196&quot;}\" data-wp-interactive=\"core\/image\" class=\"wp-block-image aligncenter size-large is-resized wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-2-1024x551.png\" alt=\"\" class=\"wp-image-876\" style=\"width:600px\" srcset=\"https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-2-1024x551.png 1024w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-2-300x161.png 300w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-2-768x413.png 768w, https:\/\/chauquest.com\/wp-content\/uploads\/2025\/05\/image-2.png 1465w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on-async--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">SSH agent tab<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">DISCLAIMER<\/h4>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\">As you may have seen from the step above you can either <strong>add the key as attachment or as external file<\/strong>. <strong>FOR MORE SECURITY<\/strong>, it is advised to use the key as external file because <strong>if your keepass database get stolen and open<\/strong> you will only<strong> loose your passphrase<\/strong> while the actual <strong>private key will stay on your computer.<\/strong><\/mark><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">GIT configuration<\/h2>\n\n\n\n<p>Git is an annoying boy in Windows, and it was in fact the most tricky part to make it work. Internet was not full of resources for this one. <br><strong>Please directly modify your git config file<\/strong> (because of quote and other annoying path related stuff), it can be found in <code>C:\\Users\\UserName\\.gitconfig<\/code>. Add the two following line in git in order to enable it to use ssh agent.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;core]\n\tsshCommand = 'C:\\\\Windows\\\\System32\\\\OpenSSH\\\\ssh.exe'\n&#91;gpg \"ssh\"]\n\tprogram = 'C:\\\\Windows\\\\System32\\\\OpenSSH\\\\ssh-keygen.exe'<\/code><\/pre>\n\n\n\n<p>You can check if it works by doing a <code>git pull<\/code> in any of your repository. You shouldn&#8217;t be prompted anymore for your passphrase.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>That&#8217;s it for this super short tutorial ! Hope you found it useful, and that now you will use the full power of <strong>KeepassXC<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was fed up to always type my passphrase when using git. I show you what modification you need to do in order to use the auto ssh-agent offered with KeepassXC.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[49,48],"tags":[51,52,56,53,58,55],"class_list":["post-873","post","type-post","status-publish","format-standard","hentry","category-it-development","category-micro-tips","tag-it","tag-keepass","tag-keepassxc","tag-password","tag-ssh-agent","tag-version-control"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/posts\/873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/comments?post=873"}],"version-history":[{"count":2,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/posts\/873\/revisions"}],"predecessor-version":[{"id":879,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/posts\/873\/revisions\/879"}],"wp:attachment":[{"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/media?parent=873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/categories?post=873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chauquest.com\/index.php\/wp-json\/wp\/v2\/tags?post=873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}