{"id":16425,"date":"2024-01-12T09:53:51","date_gmt":"2024-01-12T09:53:51","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=16425"},"modified":"2024-11-04T15:50:13","modified_gmt":"2024-11-04T15:50:13","slug":"setup-ssh-key-for-github-linux","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=16425","title":{"rendered":"Setup ssh key for Git (macOS, Linux)"},"content":{"rendered":"<p>If you don&#8217;t want to authorize yourself all the time on the server, just add an ssh key.<\/p>\n<hr>\n<p><strong>1. Generate an ssh key pair on the client<\/strong><\/p>\n<pre>\r\n$ mkdir -m 700 ~\/.ssh\r\n$ ssh-keygen -t ed25519 -b 4096 -C {user@domain.com} -f ~\/.ssh\/{key-name}\r\n<\/pre>\n<hr>\n<p><strong>2. Add the public key to the Git server<\/strong><\/p>\n<pre>\r\n$ cat ~\/.ssh\/{key-name}.pub\r\n<\/pre>\n<p>Settings on the server: <a href=\"https:\/\/bitbucket.org\/account\/settings\/ssh-keys\/\">Bitbucket<\/a>, <a href=\"https:\/\/github.com\/settings\/ssh\/\">GitHub<\/a><\/p>\n<hr>\n<p><strong>3. Add the private key to the ssh agent<\/strong><\/p>\n<p>Temporarily<\/p>\n<pre>\r\n$ eval $(ssh-agent)\r\n$ ssh-add ~\/.ssh\/{key-name}\r\n<\/pre>\n<p>Permanently<\/p>\n<pre>\r\n$ touch ~\/.zprofile\r\n$ echo \"ssh-add ~\/.ssh\/{key-name}\" >> ~\/.zprofile\r\n<\/pre>\n<p>(macOS: &#8220;.zprofile&#8221; and Linux: &#8220;.bash_profile&#8221;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you don&#8217;t want to authorize yourself all the time on the server, just add an ssh key. 1. Generate<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[24],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/16425"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16425"}],"version-history":[{"count":19,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/16425\/revisions"}],"predecessor-version":[{"id":18009,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/16425\/revisions\/18009"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16425"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}