{"id":242,"date":"2016-11-08T11:06:25","date_gmt":"2016-11-08T02:06:25","guid":{"rendered":"https:\/\/iwako.pgw.jp\/?p=242"},"modified":"2019-03-28T12:42:22","modified_gmt":"2019-03-28T03:42:22","slug":"%e6%8b%be%e7%8e%96-git%e3%81%ae%e9%81%8b%e7%94%a8%e8%a8%88%e7%94%bb%e7%ad%96%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/iwako.pgw.jp\/?p=242","title":{"rendered":"\u62fe\u7396-GIT\u306e\u904b\u7528\u8a08\u753b\u7b56\u5b9a"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/iwako.pgw.jp\/wp-content\/uploads\/2016\/11\/git-icatch.png\" alt=\"git-icatch\" width=\"600\" height=\"300\" class=\"alignnone size-full wp-image-243\" \/><br \/>\nGIT\u306b\u3064\u3044\u3066\u306a\u3093\u3068\u306a\u304f\u7406\u89e3\u3057\u3066\u3044\u308b\u4eba\u3092\u5c0d\u8c61\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u3042\u3057\u304b\u3089\u305a\u3002<br \/>\n\u30ef\u30a4\u3082\u306a\u3093\u3068\u306a\u304f\u4ee5\u4e0a\u306e\u7406\u89e3\u306f\u3057\u3066\u306a\u3044\u3051\u3069\u306a\uff01\uff08\u307e\u3055\u306b\u5916\u9053\uff09<br \/>\n\u7b2c\u4e00\u6bb5\u968e\uff1a\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u30d7\u30c3\u30b7\u30e5\u3059\u308b<br \/>\n\u7b2c\u4e8c\u6bb5\u968e\uff1a\u30ed\u30fc\u30ab\u30eb\u3092\u30ea\u30e2\u30fc\u30c8\u306b\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u3068\u672c\u756a\u74b0\u5883\u306b\u3082\u81ea\u52d5\u30d7\u30c3\u30b7\u30e5\u3059\u308b<\/p>\n<p>\u30fb\u7b2c\u4e00\u6bb5\u968e<br \/>\n\u307e\u305a\u306fGIT\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3002<br \/>\n$ git init<br \/>\n\u73fe\u5728\u306e\u30d5\u30a1\u30a4\u30eb\u5185\u5bb9\u3092\u76e3\u8996\u5c0d\u8c61\u306b\u3059\u308b\u3002<br \/>\n$ git add .<br \/>\n\u73fe\u5728\u306e\u5185\u5bb9\u3092\u30b3\u30df\u30c3\u30c8\u3059\u308b<br \/>\n$ git commit -m &#8220;\u306a\u3093\u304b\u30e1\u30c3\u30bb\u30fc\u30b8&#8221;<\/p>\n<p>\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u4f5c\u6210\uff08\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\uff09<br \/>\n$ mkdir \/var\/hoge.git<br \/>\n$ cd !$<br \/>\n$ git &#8211;bare init &#8211;share<br \/>\n&#8211;bare\u306f\u30d9\u30a2\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u3053\u3068\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u307f\u3067\u5be6\u9ad4\u304c\u306a\u3044\u3002<br \/>\n&#8211;share\u306f\u5171\u6709\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u8a2d\u5b9a\u3002<\/p>\n<p>\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u9001\u4fe1\u5148\u8a2d\u5b9a\uff08\u30ed\u30fc\u30ab\u30eb\u3067\uff09<br \/>\n$ git remote add origin ssh:\/\/<\u9001\u4fe1\u5148\u30a2\u30c9\u30ec\u30b9>:<\u30c7\u30a3\u30ec\u30af\u30c8\u30ea><br \/>\n\u4f8b\uff1agit remote add origin ssh:\/\/HOGEHOGE:\/www\/myPage<br \/>\n.ssh\/config \u306b\u66f8\u304d\u8fbc\u307e\u308c\u308b\u3002\u4ee5\u5f8c\u306f\u305d\u3061\u3089\u3092\u4fee\u6b63\u3059\u308b\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u51fa\u4f86\u305f\u3089\u3053\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30ea\u30e2\u30fc\u30c8\u306b\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u3002<br \/>\n$ git push origin master<br \/>\n\u7121\u4e8b\u30d7\u30c3\u30b7\u30e5\u3067\u304d\u305f\u3089\u7b2c\u4e00\u6bb5\u968e\u5b8c\u4e86\u3002<\/p>\n<p>\u30fb\u7b2c\u4e8c\u6bb5\u968e<br \/>\n\u6982\u5ff5\uff1a<br \/>\n\u30ed\u30fc\u30ab\u30eb\u304b\u3089\u30d7\u30c3\u30b7\u30e5\u3055\u308c\u305f\u5185\u5bb9\u3092\u3001\u30d9\u30a2\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u3042\u3089\u304b\u3058\u3081<br \/>\n\u6307\u5b9a\u3057\u3066\u304a\u3044\u305f\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u3078\u81ea\u52d5\u7684\u306b\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u3002<br \/>\n\u5229\u9ede\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u30d7\u30c3\u30b7\u30e5\u3059\u308c\u3070\u305d\u308c\u3067\u66f4\u65b0\u4f5c\u696d\u304c\u5b8c\u4e86\u3059\u308b\u3002<br \/>\n\u5f31\u9ede\u306f\u3001\u30a6\u30fc\u3093\u308f\u304b\u3089\u3093\u30fb\u30fb\u30fb\u3002<br \/>\n\u3055\u3066\u3001\u3053\u3053\u3067\u306f\u30d5\u30c3\u30af\u8655\u7406\u3068\u3044\u3046\u3082\u306e\u3092\u6d3b\u7528\u3059\u308b\u3002<br \/>\n\u307e\u305a\u306fhttp\u30b5\u30fc\u30d0\u30fc\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30af\u30ed\u30fc\u30f3\u3059\u308b\u3002<br \/>\n$ git clone \/var\/hoge.git<br \/>\n\u30ea\u30e2\u30fc\u30c8\u306ebare\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u79fb\u52d5\u3057hook\u3092\u8997\u304f\u3002<br \/>\n$ cd hook<br \/>\n\u3053\u3053\u3067post-receive\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3002<br \/>\n$ vim post-receive<br \/>\n#!\/bin\/sh<\/p>\n<p># \u672c\u756a\u74b0\u5883<br \/>\ncd \/www\/myPage<br \/>\ngit &#8211;git-dir=.git pull origin master:master<br \/>\n&#8212;-\u3053\u3053\u307e\u3067<br \/>\n\u30c6\u30b9\u30c8\u74b0\u5883\u306a\u3069\u306b\u3082\u540c\u6a23\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u540c\u3058\u3088\u3046\u306b\u8ffd\u8a18\u3057\u3066\u3044\u304f\u3002<br \/>\ncd \/www\/myPageT<br \/>\ngit &#8211;git-dir=.git pull origin develop:develop<br \/>\n\u203b\u884c\u6700\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d\u306b\u7559\u610f\uff01<\/p>\n<p>GIT\u3092\u771e\u9762\u76ee\u306b\u3084\u3063\u3066\u3044\u304f\u3068\u3059\u3054\u3044\u5206\u91cf\u306b\u306a\u308b\u306e\u3067\u3001<br \/>\n\u6c23\u306b\u306a\u308b\u4eba\u306f\u4e16\u306b\u6ea2\u308c\u308bHOW TO\u3092\u53c3\u8003\u306b\u3057\u3066\u3082\u3089\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3072\u3068\u3064\u2026\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GIT\u306b\u3064\u3044\u3066\u306a\u3093\u3068\u306a\u304f\u7406\u89e3\u3057\u3066\u3044\u308b\u4eba\u3092\u5c0d\u8c61\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u3042\u3057\u304b\u3089\u305a\u3002 \u30ef\u30a4\u3082\u306a\u3093\u3068\u306a\u304f\u4ee5\u4e0a\u306e\u7406\u89e3\u306f\u3057\u3066\u306a\u3044\u3051\u3069\u306a\uff01\uff08\u307e\u3055\u306b\u5916\u9053\uff09 \u7b2c\u4e00\u6bb5\u968e\uff1a\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u30d7\u30c3\u30b7\u30e5\u3059\u308b \u7b2c\u4e8c\u6bb5\u968e\uff1a\u30ed\u30fc\u30ab\u30eb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-242","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=242"}],"version-history":[{"count":1,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/242\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/242\/revisions\/244"}],"wp:attachment":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}