{"id":3222,"date":"2013-09-26T17:42:40","date_gmt":"2013-09-26T08:42:40","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=3222"},"modified":"2018-11-14T16:33:54","modified_gmt":"2018-11-14T07:33:54","slug":"git_ssh-%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6bitbucket%e3%81%8b%e3%82%89%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%82%a2%e3%82%a6%e3%83%88","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/09\/26\/git_ssh-%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6bitbucket%e3%81%8b%e3%82%89%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%82%a2%e3%82%a6%e3%83%88\/","title":{"rendered":"GIT_SSH \u3092\u5229\u7528\u3057\u3066bitbucket\u304b\u3089\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3001\u5317\u5ddd\u3067\u3059\u3002<\/p>\n<p>git \u306e GIT_SSH \u3092\u5229\u7528\u3059\u308b\u6a5f\u4f1a\u304c\u3042\u308a\u307e\u3057\u305f\u306e\u3067\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>GIT_SSH<\/h2>\n<p>git \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u3082\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001GIT_SSH \u74b0\u5883\u5909\u6570\u306b\u30e9\u30c3\u30d1\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6307\u5b9a\u3059\u308b\u3068<br \/>\ngit fetch , git push \u306e\u969b\u306b\u30e9\u30c3\u30d1\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a title=\"http:\/\/git-scm.com\/docs\/git#_other\" href=\"http:\/\/git-scm.com\/docs\/git#_other\" target=\"_blank\">http:\/\/git-scm.com\/docs\/git#_other<\/a><\/p>\n<p>\u901a\u5e38\u3001git\u3067\u5225\u540d\u306e\u516c\u958b\u9375\u3092\u6307\u5b9a\u3057\u3066\u3084\u308b\u5834\u5408\u306a\u3069 .ssh\/config \u306b\u6307\u5b9a\u3059\u308b\u5834\u5408\u304c\u591a\u3044\u3068<br \/>\n\u601d\u3044\u307e\u3059\u304c\u3001GIT_SSH \u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067 .ssh\/config \u304c\u5229\u7528\u3067\u304d\u306a\u3044\u74b0\u5883\u3067.ssh\/config<br \/>\n\u3068\u540c\u7b49\u306e\u8a2d\u5b9a\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u6e96\u5099<\/h2>\n<p>\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066 bitbucket \u306e git\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089 \u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u524d\u63d0\u3068\u3057\u3066\u3001bitbucket\u306b \u6b63\u3057\u304f\u516c\u958b\u9375\u304c\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u6b63\u3057\u304f\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u308b\u3068 ssh \u63a5\u7d9a\u3059\u308b\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ ssh -T git@bitbucket.org -i .ssh\/rsa-key.ppk \r\nlogged in {\u30e6\u30fc\u30b6\u540d}.\r\n\r\nYou can use git or hg to connect to Bitbucket. Shell access is disabled.<\/pre>\n<h2>.ssh\/config \u3067\u8a2d\u5b9a<\/h2>\n<p>.ssh\/config\u3067\u8a2d\u5b9a\u3059\u308b\u5834\u5408\u306f\u3001 .ssh\/config \u306b\u9375\u306e\u5834\u6240\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ vi ~\/.ssh\/config\r\n\r\n*\u4ee5\u4e0b\u3092\u8ffd\u8a18\r\nHost bitbucket.org\r\n  IdentityFile ~\/.ssh\/rsa-key.ppk<\/pre>\n<p>\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u304c\u6210\u529f\u3059\u308b\u3068\u4e0b\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ git clone git@bitbucket.org:{\u30e6\u30fc\u30b6\u540d}\/sample.git\r\nCloning into 'sample'...\r\nremote: Counting objects: 167, done.\r\nremote: Compressing objects: 100% (112\/112), done.\r\nremote: Total 167 (delta 35), reused 164 (delta 34)\r\nReceiving objects: 100% (167\/167), 151.78 KiB | 76 KiB\/s, done.\r\nResolving deltas: 100% (35\/35), done.<\/pre>\n<p>GIT_SSH \u306e\u30c6\u30b9\u30c8\u3082\u3057\u305f\u3044\u306e\u3067 config \u3092\u524a\u9664\u3059\u308b\u3068\u5931\u6557\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ git clone git@bitbucket.org:{\u30e6\u30fc\u30b6\u540d}\/sample.git\r\nfatal: destination path 'sample' already exists and is not an empty directory.<\/pre>\n<h2>GIT_SSH\u3067\u8a2d\u5b9a<\/h2>\n<p>\u307e\u305a\u306f\u3001GIT_SSH\u74b0\u5883\u5909\u6570\u306b\u6307\u5b9a\u3059\u308b\u30e9\u30c3\u30d1\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ vi ~\/gitssh.sh\r\n\r\n*\u4ee5\u4e0b\u3092\u8ffd\u52a0\r\n#! \/bin\/sh\r\nssh -i ~\/.ssh\/rsa-key.ppk \"$@\"<\/pre>\n<p>\u30e9\u30c3\u30d1\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u51fa\u6765\u305f\u3089 GIT_SSH \u3068\u3044\u3046\u540d\u524d\u3067\u74b0\u5883\u5909\u6570\u3068\u3057\u3066\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ chmod 744 ~\/gitssh.sh\r\n$ export GIT_SSH=~\/gitssh.sh\r\n\r\n$ printenv GIT_SSH\r\n\/home\/kitagawa\/gitssh.sh<\/pre>\n<p>\u6307\u5b9a\u3067\u304d\u305f\u3089 config \u3068\u540c\u3058\u3088\u3046\u306b \u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3059\u308b\u3068\u6210\u529f\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ git clone git@bitbucket.org:{\u30e6\u30fc\u30b6\u540d}\/sample.git\r\nCloning into 'sample'...\r\nremote: Counting objects: 167, done.\r\nremote: Compressing objects: 100% (112\/112), done.\r\nremote: Total 167 (delta 35), reused 164 (delta 34)\r\nReceiving objects: 100% (167\/167), 151.78 KiB | 101 KiB\/s, done.\r\nResolving deltas: 100% (35\/35), done.<\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u3001GIT_SSH \u3092\u5229\u7528\u3057\u305f\u306e\u306f OpenShift \u3067\u3001.ssh\/config \u306b\u6a29\u9650\u304c\u306a\u304b\u3063\u305f\u306e\u3067<br \/>\n\u4ee3\u66ff\u624b\u6bb5\u3068\u3057\u3066 GIT_SSH \u3092\u5229\u7528\u3057\u307e\u3057\u305f\u3002\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u3082\u8a18\u8f09\u3055\u3066\u308c\u3044\u307e\u3057\u305f\u304c<br \/>\n\u901a\u5e38\u306f config \u3067\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001GIT_SSH \u3082\u5408\u308f\u305b\u3066\u77e5\u3063\u3066\u3044\u308b\u3068\u30a4\u30b6\u3068\u3044\u3046\u6642\u306b<br \/>\n\u5f79\u306b\u7acb\u3064\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3001\u5317\u5ddd\u3067\u3059\u3002<\/p>\n<p>git \u306e GIT_SSH \u3092\u5229\u7528\u3059\u308b\u6a5f\u4f1a\u304c\u3042\u308a\u307e\u3057\u305f\u306e\u3067\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2013\/09\/26\/git_ssh-%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6bitbucket%e3%81%8b%e3%82%89%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%82%a2%e3%82%a6%e3%83%88\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[110],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/3222"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=3222"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/3222\/revisions"}],"predecessor-version":[{"id":17911,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/3222\/revisions\/17911"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=3222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=3222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=3222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}