{"id":507,"date":"2019-07-09T23:12:00","date_gmt":"2019-07-09T15:12:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=507"},"modified":"2023-11-03T23:14:14","modified_gmt":"2023-11-03T15:14:14","slug":"git-public-key","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/507","title":{"rendered":"Git public key"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>\u532f\u5165public key\u5230online git server<\/strong><br>\u6709\u4e9b\u5c08\u6848\u9700\u8981\u4e8b\u5148\u63d0\u4f9bpublic key\u5230\u5e73\u53f0\u4e0a\uff0c\u624d\u53ef\u4ee5\u4f7f\u7528\u5c08\u6848<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u65b9\u6cd5\u4e3b\u8981\u5206\u5169\u500b\u6b65\u9a5f\uff1a<\/strong><br>\u6b65\u9a5f1.add your key to git platform<br>\u6b65\u9a5f2.Check your SSH access<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6b65\u9a5f1.add your key to git platform<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1.check whether exist ssh key<\/strong><br><strong># ls -al ~\/.ssh<\/strong><br>\u5982\u679c\u6c92\u6709key\u5c31\u900f\u904e\u6b65\u9a5f2\u7522\u751fkey<br>\u5982\u679c\u6709key\u5c31\u76f4\u63a5\u5230\u6b65\u9a5f3\u8f38\u51fakey<br><strong>2.Generating a new SSH key<\/strong><br><strong># ssh-keygen -t rsa -b 4096 -C &#8220;raymond0820@gmail.com&#8221;<\/strong><br>Generating public\/private rsa key pair.<br>Enter file in which to save the key (\/root\/.ssh\/id_rsa):<br>Enter passphrase (empty for no passphrase):&nbsp;<strong>&lt; \u9023\u5230git server\u6703\u7528\u5230\u81ea\u8a02\u5bc6\u78bc&gt;<\/strong><br>Enter same passphrase again:<br>Your identification has been saved in \/root\/.ssh\/id_rsa.<br>Your public key has been saved in \/root\/.ssh\/id_rsa.pub.<br>The key fingerprint is:<br>8a:90:57:10:6f:57:4f:0e:ef:cb:fb:2a:95:4a:f5:01 raymond0820@gmail.com<br>The key&#8217;s randomart image is:<br>+&#8211;[ RSA 4096]&#8212;-+<br>| o. o . |<br>| o . *E |<br>| + . +. |<br>| . o . .. . |<br>| o . S ..o . |<br>| o . . ..o.. |<br>| . . . oo |<br>| o . |<br>| .oo. |<br>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br>3.output you key and paste to github or gitlab<br><strong># cat ~\/.ssh\/id_rsa.pub<\/strong><br>4.(optional) Adding key to the ssh-agent<br><strong># ssh-add ~\/.ssh\/id_rsa<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">refer<br>Adding a new SSH key to your GitHub account.<br>https:\/\/help.github.com\/articles\/generating-an-ssh-key\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6b65\u9a5f2.Check your SSH access<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u78ba\u4fddlocal\u548conline git server\u4e4b\u9593\u7684\u5e95\u5c64\u50b3\u8f38\u662f\u5426\u6b63\u78ba<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>#ssh -T git@github.com<\/strong><br>Warning: Permanently added the RSA host key for IP address &#8216;192.30.253.113&#8217; to the list of known hosts.<br>Enter passphrase for key &#8216;\/root\/.ssh\/id_rsa&#8217;:&nbsp;<strong>&lt; \u9019\u908a\u8981\u8f38\u5165\u505akey\u6642\u7528\u7684passphrase&gt;<\/strong><br>Hi Raymond0820! You&#8217;ve successfully authenticated, but GitHub does not provide shell access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">or<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>#ssh -T -ai ~\/.ssh\/id_rsa_raymond0820 git@github.com<\/strong><br>Enter passphrase for key &#8216;\/root\/.ssh\/id_rsa_raymond0820&#8217;:<br>Hi Raymond0820! You&#8217;ve successfully authenticated, but GitHub does not provide shell access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ps:<br>\u82e5\u4e8b\u524d\u6c92\u6709\u5148\u63d0\u4f9bpublic key\u5230git-hub\uff0c\u5247\u6703\u51fa\u73fePermission denied (publickey).<br><strong>#ssh -T -ai ~\/.ssh\/id_rsa_raymondtestproject git@github.com<\/strong><br>Enter passphrase for key &#8216;\/root\/.ssh\/id_rsa_raymondtestproject&#8217;:<br>Permission denied (publickey).<br>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ps:<br>\u82e5\u51fa\u73fessh: connect to host github.com port 22: Connection refused<br>\u7de8\u8f2f.ssh\/config<br>Host github.com<br>User &lt; email &gt;<br>Hostname ssh.github.com<br>PreferredAuthentications publickey<br>IdentityFile ~\/.ssh\/id_rsa<br>Port 443<br>\u5728\u57f7\u884cssh -T git@github.com\u505a\u6e2c\u8a66<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>refer<br>http:\/\/blog.csdn.net\/fulinus\/article\/details\/38542439<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u532f\u5165public key\u5230online git server &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[14],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-develop"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":509,"url":"https:\/\/systw.net\/note\/archives\/509","url_meta":{"origin":507,"position":0},"title":"Git basic","author":"raymond","date":"2019 \u5e74 7 \u6708 9 \u65e5","format":false,"excerpt":"\u5206\u6563\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7d71Git was created by Linus Torvalds in 2005\u2026","rel":"","context":"\u5728\u300c\u958b\u767c\u300d\u4e2d","block_context":{"text":"\u958b\u767c","link":"https:\/\/systw.net\/note\/archives\/category\/develop"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1905,"url":"https:\/\/systw.net\/note\/archives\/1905","url_meta":{"origin":507,"position":1},"title":"VulnHub ck:00","author":"raymond","date":"2025 \u5e74 1 \u6708 1 \u65e5","format":false,"excerpt":"\u9019\u662fVulnHub \u5e73\u53f0\u7684\u4e00\u500b\u7528\u65bc\u7df4\u7fd2\u6ef2\u900f\u6e2c\u8a66\u548c\u6f0f\u6d1e\u5229\u7528\u7684\u9776\u6a5f\u3002\u5b83\u88ab\u8a2d\u8a08\u70ba\u4e00\u500b\u7c21\u55ae\u96e3\u5ea6\u7684\u6311\u6230\uff0c\u76ee\u6a19\u662f\u2026","rel":"","context":"\u5728\u300c\u653b\u64ca\u624b\u6cd5\u300d\u4e2d","block_context":{"text":"\u653b\u64ca\u624b\u6cd5","link":"https:\/\/systw.net\/note\/archives\/category\/hackerskill"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":283,"url":"https:\/\/systw.net\/note\/archives\/283","url_meta":{"origin":507,"position":2},"title":"tunnel SSH","author":"raymond","date":"2019 \u5e74 10 \u6708 20 \u65e5","format":false,"excerpt":"SSH(Secure Shell) \u4e00\u7a2e\u52a0\u5bc6\u7684\u7db2\u7d61\u50b3\u8f38\u5354\u8b70\uff0c\u53ef\u8b93\u4f7f\u7528\u8005\u5728\u52a0\u5bc6\u7684\u74b0\u5883\u4e0b\u9060\u7aef\u9023\u7dda\u5230\u76ee\u6a19\u4e3b\u2026","rel":"","context":"\u5728\u300c\u5b89\u5168\u89e3\u6c7a\u65b9\u6848\u300d\u4e2d","block_context":{"text":"\u5b89\u5168\u89e3\u6c7a\u65b9\u6848","link":"https:\/\/systw.net\/note\/archives\/category\/securitysloution"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":868,"url":"https:\/\/systw.net\/note\/archives\/868","url_meta":{"origin":507,"position":3},"title":"IOS Password","author":"raymond","date":"2008 \u5e74 10 \u6708 7 \u65e5","format":false,"excerpt":"\u8a2d\u5b9a\u9032\u5165\u7279\u6b0a\u6a21\u5f0f\u5bc6\u78bc\u67092\u7a2e,\u5982\u4e0b:(config)#enable password < wor\u2026","rel":"","context":"\u5728\u300cCisco security\u300d\u4e2d","block_context":{"text":"Cisco security","link":"https:\/\/systw.net\/note\/archives\/category\/network\/cisco-security"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":44,"url":"https:\/\/systw.net\/note\/archives\/44","url_meta":{"origin":507,"position":4},"title":"medusa and hydra","author":"raymond","date":"2024 \u5e74 6 \u6708 20 \u65e5","format":false,"excerpt":"medusa \u548c hydra \u90fd\u662f\u5e38\u898b\u7684\u66b4\u529b\u7834\u89e3\u5de5\u5177\uff0c\u5ee3\u6cdb\u7528\u65bc\u6ef2\u900f\u6e2c\u8a66\u8207\u5b89\u5168\u8a55\u4f30\u4e2d\u3002\u5b83\u5011\u7684\u4e3b\u8981\u7528\u9014\u662f\u2026","rel":"","context":"\u5728\u300cred team\u300d\u4e2d","block_context":{"text":"red team","link":"https:\/\/systw.net\/note\/archives\/category\/securitytool\/red-team"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":611,"url":"https:\/\/systw.net\/note\/archives\/611","url_meta":{"origin":507,"position":5},"title":"rsync\u7570\u5730\u5099\u4efd","author":"raymond","date":"2008 \u5e74 10 \u6708 28 \u65e5","format":false,"excerpt":"rsync\u7570\u5730\u5099\u4efd(http:\/\/rsync.samba.org) \u4e3b\u8981\u6709\u5169\u7a2e\u65b9\u6cd51\u4f7f\u7528ssh\u901a\u9053\u6307\u2026","rel":"","context":"\u5728\u300c\u7cfb\u7d71\u7ba1\u7406\u5de5\u5177\u300d\u4e2d","block_context":{"text":"\u7cfb\u7d71\u7ba1\u7406\u5de5\u5177","link":"https:\/\/systw.net\/note\/archives\/category\/system\/systemtool"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}