{"id":2195,"date":"2014-11-18T10:24:39","date_gmt":"2014-11-18T01:24:39","guid":{"rendered":"http:\/\/www.whoocus.com\/blog\/?p=2195"},"modified":"2014-11-18T10:31:36","modified_gmt":"2014-11-18T01:31:36","slug":"database-yml-%e7%ad%89%e3%81%ae-git%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.blowfish.co.jp\/?p=2195","title":{"rendered":"database.yml \u7b49\u306e Git\u7ba1\u7406"},"content":{"rendered":"<p>Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001Git\u7b49\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3092\u4f7f\u7528\u3057\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u305d\u306e\u307e\u307e git add\u3001git commit\u3057\u3066\u3057\u307e\u3044\u516c\u958b\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308b\u3002\u3057\u304b\u3057\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u601d\u308f\u3057\u304f\u306a\u3044\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7b49\u304c\u3042\u308b\u3002<\/p>\n<p>database.yml\u3084secrets.yml\u7b49\u3060\u3002<\/p>\n<p>\u305d\u3053\u3067\u4e00\u5ea6\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u306b\u5165\u308c\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306b\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u304b\u3089\u5916\u3059\u65b9\u6cd5\u3002<\/p>\n<p>[bash]<br \/>\n$ git rm &#8211;cached database.yml<br \/>\n[\/bash]<\/p>\n<p>&#8211;cached\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u306a\u3044\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u81ea\u4f53\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<p>\u305d\u3057\u3066\u518d\u3073\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u306a\u3044\u3088\u3046\u306b.gitignore\u306b\u4e0b\u8a18\u3092\u5fc5\u305a\u8ffd\u8a18\u3059\u308b\u3002<\/p>\n<p>[bash]<br \/>\n\/config\/database.yml<br \/>\n[\/bash]<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c1\u30fc\u30e0\u3067\u5171\u6709\u3059\u308b\u5834\u5408\u306b\u306f\u3001database.yml\u3092\u30b3\u30d4\u30fc\u3057\u3066database.yml.sample\u7b49\u3092\u4f5c\u6210\u3057\u3001\u3053\u308c\u3092\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3057\u3066\u304a\u304f\u65b9\u6cd5\u304c\u3088\u3044\u3002\u5f53\u7136\u3001\u305d\u306e\u4e2d\u8eab\u306b\u91cd\u8981\u60c5\u5831\u3092\u8a18\u8ff0\u3057\u3066\u3057\u307e\u3063\u3066\u306f\u610f\u5473\u304c\u7121\u3044\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u4e07\u304c\u4e00&#8211;cached\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u306a\u3044\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u81ea\u4f53\u3092\u524a\u9664\u3057\u3066\u7126\u3063\u3066\u3057\u307e\u3063\u305f\u6642\u306e\u30ea\u30ab\u30d0\u30ea\u65b9\u6cd5\u3002<\/p>\n<p>[bash]<br \/>\n$ git reset HEAD database.yml<br \/>\n$ git checkout database.yml<br \/>\n[\/bash]<\/p>\n<p>\u3053\u308c\u306f\u53c2\u8003\u307e\u3067\u306b\u899a\u3048\u66f8\u304d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001Git\u7b49\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3092\u4f7f\u7528\u3057\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u305d\u306e\u307e\u307e git add\u3001git commit\u3057\u3066\u3057\u307e\u3044\u516c\u958b\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308b\u3002\u3057\u304b\u3057\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u601d\u308f\u3057\u304f\u306a\u3044\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7b49\u304c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[24,25,14,4],"tags":[],"class_list":["post-2195","post","type-post","status-publish","format-standard","hentry","category-git","category-rails","category-ruby","category-tech"],"_links":{"self":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2195"}],"version-history":[{"count":3,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2195\/revisions"}],"predecessor-version":[{"id":2198,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2195\/revisions\/2198"}],"wp:attachment":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}