{"id":646,"date":"2012-01-03T12:19:25","date_gmt":"2012-01-03T20:19:25","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=646"},"modified":"2012-01-03T12:19:25","modified_gmt":"2012-01-03T20:19:25","slug":"git-prepare-your-repository-step-1","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2012\/01\/03\/git-prepare-your-repository-step-1\/","title":{"rendered":"Git: Prepare your repository &#8211; step 1"},"content":{"rendered":"<p>&nbsp;<\/p>\n<div>Here I&rsquo;ll explain how you can create a new repository for your projects and use GIT for your version control needs.<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>For this, I&rsquo;ll assume everything is already installed (git and stuff). This also assumes you&rsquo;re using an Operating System and not the Vermont thing.<\/div>\n<div>&nbsp;<\/div>\n<div>Replace &ldquo;example.com&rdquo; with your own domain.<\/div>\n<div>&nbsp;<\/div>\n<div>1. Create a base repository<\/div>\n<div>&nbsp;<\/div>\n<pre>$ mkdir example.com &amp;&amp; cd example.com\n\n$ git init<\/pre>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>2. Create a standard .gitignore file<\/div>\n<div>&nbsp;<\/div>\n<pre>$ nano .gitignore<\/pre>\n<div>&nbsp;<\/div>\n<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/div>\n<pre>cgi-bin\/*\n\nupload\/\n\n.idea\/*\n\n# Compiled source #\n\n###################\n\n*.com\n\n*.class\n\n*.dll\n\n*.exe\n\n*.o\n\n*.so\n\n# Packages #\n\n############\n\n# it&#39;s better to unpack these files and commit the raw source\n\n# git has its own built in compression methods\n\n*.7z\n\n*.dmg\n\n*.gz\n\n*.iso\n\n*.jar\n\n*.rar\n\n*.tar\n\n*.zip\n\n# Logs and databases #\n\n######################\n\n*.log\n\n*.sql\n\n*.sqlite\n\n# OS generated files #\n\n######################\n\n.DS_Store*\n\nehthumbs.db\n\nIcon?\n\nThumbs.db<\/pre>\n<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/div>\n<div>&nbsp;<\/div>\n<div>3. Add and commit the file to your local repository.<\/div>\n<pre>$ git add .gitignore\n\n$ git commit -m &quot;Added standard gitignore file&quot;<\/pre>\n<div>&nbsp;<\/div>\n<div>4. Prepare your local repository for transportation:<\/div>\n<pre>$ cd ..\n\n$ git clone --bare example.com example.com.git\n\n$ touch example.com.git\/git-daemon-export-ok<\/pre>\n<div>&nbsp;<\/div>\n<div>5. Copy it to your server<\/div>\n<pre>$ scp -r example.com.git SERVER:~\/PATH_ON_THE_SERVER\/example.com.git<\/pre>\n<div>&nbsp;<\/div>\n<div>6. Finish preparing your repository on the server:<\/div>\n<div>&nbsp;<\/div>\n<pre>$ ssh SERVER\n\n$ cd ~\/PATH_ON_THE_SERVER\/example.com.git\n\n$ git --bare update-server-info\n\n$ cd hooks\n\n$ mv post-update.sample post-update\n\n$ chmod a+x post-update<\/pre>\n<div>&nbsp;<\/div>\n<div>From this point on, you should be able to clone your repository and start working.<\/div>\n<div>&nbsp;<\/div>\n<div>Drop me a line if this does not work for you, and I&#39;ll be glad to try and help.<\/div>\n<div>&nbsp;<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Here I&rsquo;ll explain how you can create a new repository for your projects and use GIT for your version control needs. &nbsp; &nbsp; For this, I&rsquo;ll assume everything is already installed (git and stuff). This also assumes you&rsquo;re using an Operating System and not the Vermont thing. &nbsp; Replace&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2012\/01\/03\/git-prepare-your-repository-step-1\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[133,159,293],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-git","tag-example-howto","tag-git","tag-repository"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=646"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/646\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}