{"id":5524,"date":"2019-08-29T22:30:45","date_gmt":"2019-08-30T03:30:45","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=5524"},"modified":"2019-08-29T22:30:45","modified_gmt":"2019-08-30T03:30:45","slug":"using-file-system-as-a-git-repository","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=5524","title":{"rendered":"Using File System As A Git Repository"},"content":{"rendered":"<p>I&#8217;ve used GitLab for quite some time, and as a full featured CI\/CD platform that also provides git functionality &#8230; it&#8217;s awesome. But it&#8217;s also serious overkill for someone who wants to coordinate code with another developer or two. Or just keep history for their code. Or a backup. To accomplish this, all you need is drive space. If you&#8217;ve got a file server, any folder on the share can be a git repository.<\/p>\n<p>On the <em>server<\/em>, create a git repository and add something to it.<\/p>\n<pre>Z:\\Temp\\test&gt;<strong>git init<\/strong>\r\nInitialized empty Git repository in Z:\/Temp\/test\/.git\/\r\n\r\nZ:\\Temp\\test&gt;<strong>notepad testfile.txt<\/strong>\r\n\r\nZ:\\Temp\\test&gt;<strong>git add testfile.txt<\/strong>\r\n\r\nZ:\\Temp\\test&gt;<strong>git commit -m \"Initial file upload\"<\/strong>\r\n[master (root-commit) 9a3ebe7] Initial file upload\r\n1 file changed, 1 insertion(+)\r\ncreate mode 100644 testfile.txt<\/pre>\n<p>Then on your client, either clone the repo from the drive path<\/p>\n<pre>C:\\Users\\lisa&gt;<strong>git clone file:\/\/z:\/temp\/test<\/strong>\r\nCloning into 'test'...\r\nremote: Enumerating objects: 3, done.\r\nremote: Counting objects: 100% (3\/3), done.\r\nremote: Total 3 (delta 0), reused 0 (delta 0)\r\nReceiving objects: 100% (3\/3), done.<\/pre>\n<p>Or from the UNC path<\/p>\n<pre>C:\\Users\\lisa&gt;<strong>git clone file:\/\/server01.example.com\/data\/temp\/test<\/strong>\r\nCloning into 'test'...\r\nremote: Enumerating objects: 3, done.\r\nremote: Counting objects: 100% (3\/3), done.\r\nremote: Total 3 (delta 0), reused 0 (delta 0)\r\nReceiving objects: 100% (3\/3), done.<\/pre>\n<p>I prefer to use the UNC paths \u2013 if my drive letter fails to map for some reason, the UNC path is still available.<\/p>\n<p>If you&#8217;ve got pre-existing code, there&#8217;s a bit of a different process. On the server, create an empty folder and use \u201cgit init\u201d to initialize the empty repo. On the client where the code exists, run:<\/p>\n<pre>git init\r\ngit add *\r\ngit commit -m \u201cInitial code upload\u201d\r\ngit remote add origin git clone file:\/\/server01.example.com\/data\/temp\/test\r\ngit push origin master<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve used GitLab for quite some time, and as a full featured CI\/CD platform that also provides git functionality &#8230; it&#8217;s awesome. But it&#8217;s also serious overkill for someone who wants to coordinate code with another developer or two. Or just keep history for their code. Or a backup. To accomplish this, all you need &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,30],"tags":[233],"class_list":["post-5524","post","type-post","status-publish","format-standard","hentry","category-coding","category-system-administration","tag-git"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5524"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5524\/revisions"}],"predecessor-version":[{"id":5525,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5524\/revisions\/5525"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}