{"id":830,"date":"2012-09-04T23:28:38","date_gmt":"2012-09-05T07:28:38","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=830"},"modified":"2012-09-04T23:28:38","modified_gmt":"2012-09-05T07:28:38","slug":"git-prepare-a-repository-for-your-project","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2012\/09\/04\/git-prepare-a-repository-for-your-project\/","title":{"rendered":"Git: Prepare a repository for your project"},"content":{"rendered":"<p>&nbsp;<\/p>\n<div>Follow these steps to manage your project using GIT:<\/div>\n<div>&nbsp;<\/div>\n<div>1. create an empty folder:<\/div>\n<div>&nbsp;<\/div>\n<div>$ mkdir menospior.com &amp;&amp; cd menospior.com<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>2. Create an empty repository:<\/div>\n<div>&nbsp;<\/div>\n<div>$ git init<\/div>\n<div>Initialized empty Git repository in \/home\/httpd\/domains\/menospior.com\/.git\/<\/div>\n<div>&nbsp;<\/div>\n<div>3. Create a standard .gitignore file:<\/div>\n<div>&nbsp;<\/div>\n<div>$ nano .gitignore<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>cgi-bin\/*<\/div>\n<div>upload\/<\/div>\n<div>.idea\/*<\/div>\n<div># Compiled source #<\/div>\n<div>###################<\/div>\n<div>*.com<\/div>\n<div>*.class<\/div>\n<div>*.dll<\/div>\n<div>*.exe<\/div>\n<div>*.o<\/div>\n<div>*.so<\/div>\n<div># Packages #<\/div>\n<div>############<\/div>\n<div># it&#39;s better to unpack these files and commit the raw source<\/div>\n<div># git has its own built in compression methods<\/div>\n<div>*.7z<\/div>\n<div>*.dmg<\/div>\n<div>*.gz<\/div>\n<div>*.iso<\/div>\n<div>*.jar<\/div>\n<div>*.rar<\/div>\n<div>*.tar<\/div>\n<div>*.zip<\/div>\n<div># Logs and databases #<\/div>\n<div>######################<\/div>\n<div>*.log<\/div>\n<div>*.sql<\/div>\n<div>*.sqlite<\/div>\n<div># OS generated files #<\/div>\n<div>######################<\/div>\n<div>.DS_Store*<\/div>\n<div>ehthumbs.db<\/div>\n<div>Icon?<\/div>\n<div>Thumbs.db<\/div>\n<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>4. Add and commit the file<\/div>\n<div>&nbsp;<\/div>\n<div>$ git add .gitignore<\/div>\n<div>$ git commit -m &quot;Added standard .gitignore file&quot;<\/div>\n<div>[master (root-commit) 8bce6b1] Added standard .gitignore file<\/div>\n<div>&nbsp;1 file changed, 34 insertions(+)<\/div>\n<div>&nbsp;create mode 100644 .gitignore<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>5. Prepare your local repository for transportation<\/div>\n<div>$ cd ..<\/div>\n<div>$ git clone &#8211;bare menospior.com menospior.com.git<\/div>\n<div>Cloning into bare repository &#39;menospior.com.git&#39;&#8230;<\/div>\n<div>done.<\/div>\n<div>$ touch menospior.com.git\/git-daemon-export-ok<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>6. Copy it to a remote server:<\/div>\n<div>&nbsp;<\/div>\n<div>$ scp -r menospior.com.git mt:~\/domains\/git.portnumber53.com\/html\/menospior.com.git<\/div>\n<div>exclude &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp;240 &nbsp; &nbsp; 0.2KB\/s &nbsp; 00:00<\/div>\n<div>ce6b1371dfa41cb537d5272bb76e038e043f78 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp;148 &nbsp; &nbsp; 0.1KB\/s &nbsp; 00:00<\/div>\n<div>4122f04b2c73f00f5ad1098df5f4cbf2707a14 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp; 55 &nbsp; &nbsp; 0.1KB\/s &nbsp; 00:00<\/div>\n<div>56e31ebcc35ab6555ef10a60b10fbc19944e90 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp;266 &nbsp; &nbsp; 0.3KB\/s &nbsp; 00:00<\/div>\n<div>HEAD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp; 23 &nbsp; &nbsp; 0.0KB\/s &nbsp; 00:00<\/div>\n<div>git-daemon-export-ok &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp; &nbsp;0 &nbsp; &nbsp; 0.0KB\/s &nbsp; 00:00<\/div>\n<div>update.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% 3611 &nbsp; &nbsp; 3.5KB\/s &nbsp; 00:00<\/div>\n<div>post-update.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp;189 &nbsp; &nbsp; 0.2KB\/s &nbsp; 00:00<\/div>\n<div>applypatch-msg.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp;452 &nbsp; &nbsp; 0.4KB\/s &nbsp; 00:00<\/div>\n<div>pre-commit.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% 1704 &nbsp; &nbsp; 1.7KB\/s &nbsp; 00:00<\/div>\n<div>commit-msg.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp;896 &nbsp; &nbsp; 0.9KB\/s &nbsp; 00:00<\/div>\n<div>pre-applypatch.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp;398 &nbsp; &nbsp; 0.4KB\/s &nbsp; 00:00<\/div>\n<div>prepare-commit-msg.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% 1239 &nbsp; &nbsp; 1.2KB\/s &nbsp; 00:00<\/div>\n<div>pre-rebase.sample &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% 4951 &nbsp; &nbsp; 4.8KB\/s &nbsp; 00:00<\/div>\n<div>packed-refs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp; 85 &nbsp; &nbsp; 0.1KB\/s &nbsp; 00:00<\/div>\n<div>config &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 100% &nbsp;125 &nbsp; &nbsp; 0.1KB\/s &nbsp; 00:00<\/div>\n<div>description &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100% &nbsp; 73 &nbsp; &nbsp; 0.1KB\/s &nbsp; 00:00<\/div>\n<div>&nbsp;<\/div>\n<div>7. Finish preparing your repository on the remote server<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>$ ssh mt<\/div>\n<div>Linux n22 3.2.6mtv10 #1 SMP Wed Apr 4 09:28:15 PDT 2012 x86_64<\/div>\n<div>&nbsp;<\/div>\n<div>$ cd ~\/domains\/git.portnumber53.com\/html\/menospior.com.git\/<\/div>\n<div>$ git &#8211;bare update-server-info<\/div>\n<div>$ cd hooks<\/div>\n<div>$ mv post-update.sample post-update<\/div>\n<div>$ chmod a+x post-update<\/div>\n<div>$ exit<\/div>\n<div>logout<\/div>\n<div>Connection to s97042.gridserver.com closed.<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>8. Now clone your repository locally so you can start working<\/div>\n<div>&nbsp;<\/div>\n<div>$ git clone mt:~\/domains\/git.portnumber53.com\/html\/menospior.com.git menospior.dev<\/div>\n<div>Cloning into &#39;menospior.dev&#39;&#8230;<\/div>\n<div>remote: Counting objects: 3, done.<\/div>\n<div>remote: Compressing objects: 100% (2\/2), done.<\/div>\n<div>remote: Total 3 (delta 0), reused 0 (delta 0)<\/div>\n<div>Receiving objects: 100% (3\/3), done.<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Follow these steps to manage your project using GIT: &nbsp; 1. create an empty folder: &nbsp; $ mkdir menospior.com &amp;&amp; cd menospior.com &nbsp; &nbsp; &nbsp; 2. Create an empty repository: &nbsp; $ git init Initialized empty Git repository in \/home\/httpd\/domains\/menospior.com\/.git\/ &nbsp; 3. Create a standard .gitignore file: &nbsp; $&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2012\/09\/04\/git-prepare-a-repository-for-your-project\/\"> 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":[1],"tags":[],"class_list":["post-830","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/830","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=830"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/830\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}