<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">tl;dr: how do I set up git push on debian?</div><div class=""><br class=""></div><div class="">But first, some of the evolution in my thinking on web site repositories and more about the problem I’m trying to solve:</div><div class=""><br class=""></div>Some of you don’t know that, while I’m a Mac desktop user, I have a Linux VPS with <a href="http://prgmr.com" class="">prgmr.com</a> (it used to be a Linux box in the garage, but I ran the numbers and a VPS is a wash long-term cost-wise, plus it doesn’t tax our limited house bandwidth).<div class=""><br class=""></div><div class="">I also run my largest (in either space or bandwidth) sites on WP Engine, which is a premium offering involving a careful mix of security, git (via git labs), with a front end involving caching and nginx. WP Engine is a dedicated WordPress hosting site.</div><div class=""><br class=""></div><div class="">I’ve recently learned a lot about git deployment of websites from WP Engine, and I have been re-thinking how I deploy my websites. For the last year-ish, I’ve just dumped the whole directory tree into git, and I push that up to private <a href="http://bitbucket.org" class="">bitbucket.org</a> repositories as backups.</div><div class=""><br class=""></div><div class="">For years, I’ve simply rsynced, excluding the git directory [1], and that’s worked pretty well. Due to WP Engine’s setup, it doesn’t work there, so I’ve been using the more fiddly and annoying SFTP via Transmit (Mac app).</div><div class=""><br class=""></div><div class="">However, WP Engine’s .gitignore file is a work of art. [2] Essentially, they argue against putting WordPress’s core files in one’s repository [3], because those files are always available.</div><div class=""><br class=""></div><div class="">Historically, I’ve kept my local copy of the website that’s under version control a *complete* copy of the website in question, including any uploads (e.g., [4]), but that’s part of WP Engine’s .gitignore.</div><div class=""><br class=""></div><div class="">Why? Because repositories aren’t backups. I happen to have been using repositories as backups, but they’re not.</div><div class=""><br class=""></div><div class="">In updating sites or moving WordPress sites, *the* most fragile portion of it is not losing all the images in the wp-content/uploads/ directlory. A friend of mine made this mistake last year, and is just now trying to fix it. [5]</div><div class=""><br class=""></div><div class="">So it seems the better technological solution is backing up the non-WordPress-core stuff via a different technological method, e.g., WordPress Backup to Dropbox [6] (which works spectacularly, btw).</div><div class=""><br class=""></div><div class="">For my WP Engine sites, updating a git repository and pushing the changes looks like this:</div><div class=""><br class=""></div><div class="">1. Commit changes to local repo:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>$ git commit -m “my commit message”</div><div class=""><br class=""></div><div class="">2. Push changes to my bitbucket repository:</div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>$ git push -u origin --all</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Counting objects: 3337, done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Delta compression using up to 4 threads.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Compressing objects: 100% (3249/3249), done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Writing objects: 100% (3337/3337), 20.92 MiB | 7 KiB/s, done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Total 3337 (delta 346), reused 0 (delta 0)</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>To git@bitbucket.org:desamo/desamo.graphics.git</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> * [new branch] master -> master</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Branch master set up to track remote branch master from origin.</div></div><div class=""><br class=""></div><div class="">3. Deploy to WP Engine, note the cool commit to a pre-deploy jail:</div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>$ git push production master</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Counting objects: 3337, done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Delta compression using up to 4 threads.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Compressing objects: 100% (3249/3249), done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Writing objects: 100% (3337/3337), 20.96 MiB | 28 KiB/s, done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Total 3337 (delta 346), reused 0 (delta 0)</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: <a href="http://git.wpengine.com" class="">git.wpengine.com</a>: validating</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - warning: changes will be deployed to production application ...</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: validating files in 4c312d1 ...</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: found application servers ...</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - success: validation complete!</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: <a href="http://git.wpengine.com" class="">git.wpengine.com</a>: deploying</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: preparing application updates ............ done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: checking submodules ...... done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: ensuring permissions ................................................ done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: - info: deploying to production environment .................. done.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>remote: <a href="http://git.wpengine.com" class="">git.wpengine.com</a>: complete!</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>To git@git.wpengine.com:production/desamographics.git</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> * [new branch] master -> master</div></div><div class=""><br class=""></div><div class="">*** Now that we’ve taken this rather lengthy stroll on this short pier… ***</div><div class=""><br class=""></div><div class="">So, my current problem is: I’d like to replicate using git push to push to my VPS as well, but I’m uncertain how to set that up on the Debian side. I’ve got quite a few WordPress sites to deploy….</div><div class=""><br class=""></div><div class="">I think it would be far less error prone than my current methodology (which does include a cron rsync push every six hours). It’s harder to accidentally rsync cross directory structures (DAMHIKT) when you use something like git push.</div><div class=""><br class=""></div><div class="">Every time I Google for git or git push and Debian, I get a whole bunch of unrelated articles. Sigh.</div><div class=""><br class=""></div><div class="">Deirdre</div><div class=""><br class=""></div><div class="">[1] Save for a recent oops, documented in this post: <a href="http://deirdre.net/elloras-cave-it-infrastructure-statement/" class="">http://deirdre.net/elloras-cave-it-infrastructure-statement/</a></div><div class="">[2] <a href="http://cdn.wpengine.com/wp-content/uploads/2013/10/recommended-gitignore-no-wp.txt" class="">http://cdn.wpengine.com/wp-content/uploads/2013/10/recommended-gitignore-no-wp.txt</a></div><div class="">[3] <a href="http://wpengine.com/git/" class="">http://wpengine.com/git/</a></div><div class="">[4] <a href="http://deirdre.net/wp-content/uploads/2015/01/elloras-cave-blog-header.jpg" class="">http://deirdre.net/wp-content/uploads/2015/01/elloras-cave-blog-header.jpg</a></div><div class="">[5] <a href="http://jennytrout.com/?p=8792" class="">http://jennytrout.com/?p=8792</a></div><div class="">[6] <a href="https://wordpress.org/plugins/wordpress-backup-to-dropbox/" class="">https://wordpress.org/plugins/wordpress-backup-to-dropbox/</a></div><div class=""><br class=""></div></body></html>