Git

I’m looking at ways to improve (or modernize) my workflow with regard to pushing changes to the remote server. Right now it’s the usual grind of edit a local file then SFTP to the remote. It works, it’s fine but I want to get more in the habit of tracking changes, hence Git. So I would like to incorporate it into the mix by first pushing the changes to Git (remote installation, obviously) which would then automatically deploy the changes to the site/remote files (I’m using a CMS).

My web host does not by default have Git installed so that’s the first step (assuming they’re willing to install it), but moving beyond that what else is required with regard to software or actual workflow to make the above scenario happen? I’ve used GitHub and Bitbucket and also have it installed locally so I have a grasp of Git basics.

Todd
http://xiiro.com


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed. You might want to investigate that. I am not sure what they would do in your case, but they are often used to trigger a blog post, or to trigger Jenkins (continuous integration test) to run the new code. There may be something in there that you could piggy-back on. I am not sure that your host would need to have Git on their server (many would refuse, citing security reasons, and they may be right) for this to work.

Walter

On Sep 1, 2013, at 1:21 AM, Todd wrote:

I’m looking at ways to improve (or modernize) my workflow with regard to pushing changes to the remote server. Right now it’s the usual grind of edit a local file then SFTP to the remote. It works, it’s fine but I want to get more in the habit of tracking changes, hence Git. So I would like to incorporate it into the mix by first pushing the changes to Git (remote installation, obviously) which would then automatically deploy the changes to the site/remote files (I’m using a CMS).

My web host does not by default have Git installed so that’s the first step (assuming they’re willing to install it), but moving beyond that what else is required with regard to software or actual workflow to make the above scenario happen? I’ve used GitHub and Bitbucket and also have it installed locally so I have a grasp of Git basics.

Todd
http://xiiro.com


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I often read about people using Git instead of (S)FTP for deployment (not any how-to descriptions, all pretty vague) and I always get the impression they have Git installed on their own server. But since you mentioned security issues I’m now wondering if these people are using private servers or are working in a much more complex or bespoke development environment where everything is managed on a very granular level.

I’ll look into the “hooks” aspect. I’m thinking if this isn’t a workflow you’re too familiar with (you would know better than I) then it may very well be beyond the scope of my abilities to successfully pull-off.

Todd

On Sep 1, 2013, at 11:37 AM, Walter Lee Davis email@hidden wrote:

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed. You might want to investigate that. I am not sure what they would do in your case, but they are often used to trigger a blog post, or to trigger Jenkins (continuous integration test) to run the new code. There may be something in there that you could piggy-back on. I am not sure that your host would need to have Git on their server (many would refuse, citing security reasons, and they may be right) for this to work.

Walter

On Sep 1, 2013, at 1:21 AM, Todd wrote:

I’m looking at ways to improve (or modernize) my workflow with regard to pushing changes to the remote server. Right now it’s the usual grind of edit a local file then SFTP to the remote. It works, it’s fine but I want to get more in the habit of tracking changes, hence Git. So I would like to incorporate it into the mix by first pushing the changes to Git (remote installation, obviously) which would then automatically deploy the changes to the site/remote files (I’m using a CMS).

My web host does not by default have Git installed so that’s the first step (assuming they’re willing to install it), but moving beyond that what else is required with regard to software or actual workflow to make the above scenario happen? I’ve used GitHub and Bitbucket and also have it installed locally so I have a grasp of Git basics.

Todd
http://xiiro.com


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m finding a lot of examples of how to do what I want. There are more variations than I expected, many of which look surprisingly straightforward. And you’re right, hooks figure prominently into it. I feel fairly confident I can get one of them to work, assuming there aren’t any unusual hosting restrictions.

Todd

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed. You might want to investigate that. I am not sure what they would do in your case, but they are often used to trigger a blog post, or to trigger Jenkins (continuous integration test) to run the new code. There may be something in there that you could piggy-back on. I am not sure that your host would need to have Git on their server (many would refuse, citing security reasons, and they may be right) for this to work.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Todd,

you already watched this (Klingon currently to me)?

Is it this you’re probably after?

Bear with me if not :slight_smile:

Cheers

Thomas


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Thomas, that one is new to me. I’ll have a look.

Last night I did find another tutorial of his http://css-tricks.com/video-screencasts/109-getting-off-ftp-and-onto-git-deployment-with-beanstalk/ which is yet another variation of the same concept. Part of my problem with some of these tutorials is that the server configuration they refer to are different than mine so I’m not sure where things need to go. I still haven’t gotten anything to work but I’m chipping away at it.

Todd

#128: Effeckt.css, Local Setup with Grunt, and Contributing on GitHub | CSS-Tricks - CSS-Tricks


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It returns this: /usr/bin/git

Actually, now that I think about it I’m not sure where this is coming from, I don’t see any such structure on the remote server.

Todd

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, you wouldn’t necessarily, since you’re not logged in as root. You’re probably chrooted into your home folder when you log in as yourself. PHP runs as root, which is why it sees the whole directory structure.

Walter

On Sep 4, 2013, at 4:39 PM, Todd wrote:

It returns this: /usr/bin/git

Actually, now that I think about it I’m not sure where this is coming from, I don’t see any such structure on the remote server.

Todd
http://xiiro.com

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Makes sense.

Well, I’m not able to get the auto-update to work which is unfortunate but I’m glad I got this far. However there’s a bigger a security problem with the .git folder being publicly accessible in the site root. I think other tuts skirted this issue in some clever way so I think I need to keep looking unless I can find a way to make it work without putting it in public_html.

It was fun while it lasted.

Todd

Well, you wouldn’t necessarily, since you’re not logged in as root. You’re probably chrooted into your home folder when you log in as yourself. PHP runs as root, which is why it sees the whole directory structure.

Walter

On Sep 4, 2013, at 4:39 PM, Todd wrote:

It returns this: /usr/bin/git

Actually, now that I think about it I’m not sure where this is coming from, I don’t see any such structure on the remote server.

Todd
http://xiiro.com

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can htaccess the .git folder into oblivion.

<Directory \.git>
	Order deny,allow
	Deny from all
</Directory>

That’s untested, but it should get you started.

Walter

On Sep 4, 2013, at 5:36 PM, Todd wrote:

Makes sense.

Well, I’m not able to get the auto-update to work which is unfortunate but I’m glad I got this far. However there’s a bigger a security problem with the .git folder being publicly accessible in the site root. I think other tuts skirted this issue in some clever way so I think I need to keep looking unless I can find a way to make it work without putting it in public_html.

It was fun while it lasted.

Todd
http://xiiro.com

Well, you wouldn’t necessarily, since you’re not logged in as root. You’re probably chrooted into your home folder when you log in as yourself. PHP runs as root, which is why it sees the whole directory structure.

Walter

On Sep 4, 2013, at 4:39 PM, Todd wrote:

It returns this: /usr/bin/git

Actually, now that I think about it I’m not sure where this is coming from, I don’t see any such structure on the remote server.

Todd
http://xiiro.com

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks, that seems to have worked. Something else I’ve been working on …

I’ve been looking at other auto-deploy scripts and none of them are working for me, though a manual git pull via SSH still works.

For example, in this tut http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/ if you look at the ‘Configuring the Script’ section it says “… pass in the path to your web-root”.

I assume it’s in this section located at the bottom of the script,

$deploy = new Deploy('/var/www/foobar.com');

I used my site but no luck. Is it possible the ‘/var/www/’ part is different on my server? Could that be the problem? Not sure where else to look for problems.

Todd

You can htaccess the .git folder into oblivion.

<Directory .git>
Order deny,allow
Deny from all

That’s untested, but it should get you started.

Walter

On Sep 4, 2013, at 5:36 PM, Todd wrote:

Makes sense.

Well, I’m not able to get the auto-update to work which is unfortunate but I’m glad I got this far. However there’s a bigger a security problem with the .git folder being publicly accessible in the site root. I think other tuts skirted this issue in some clever way so I think I need to keep looking unless I can find a way to make it work without putting it in public_html.

It was fun while it lasted.

Todd
http://xiiro.com

Well, you wouldn’t necessarily, since you’re not logged in as root. You’re probably chrooted into your home folder when you log in as yourself. PHP runs as root, which is why it sees the whole directory structure.

Walter

On Sep 4, 2013, at 4:39 PM, Todd wrote:

It returns this: /usr/bin/git

Actually, now that I think about it I’m not sure where this is coming from, I don’t see any such structure on the remote server.

Todd
http://xiiro.com

Try writing

<?php echo( shell_exec('/usr/bin/env git pull') ); ?>

and see what you get in the browser when you visit that hook page.

Walter

On Sep 4, 2013, at 4:19 PM, Todd wrote:

‘pwd’ returned this: /home/myaccount/public_html
‘which git’ returned this: /usr/bin/git

This seems right.

Todd
http://xiiro.com

On Sep 4, 2013, at 3:58 PM, Todd wrote:

I now have a fully-functioning Git deployment workflow (all within Coda and using Bitbucket), no more SFTP. I looked at a lot of tuts but this is the one I managed to get (mostly) working http://www.blog.philiptutty.com/?p=67.

The only functionality I’m missing (which is the key reason I’m doing this at all) is getting the auto-update (git pull) to work. At the end of the above tut it says to place this,

<?php `git pull`;

in a php file in the Git working directory, which I assume is the site root (public_html) on the remote server. Then I pointed my Bitbucket ‘Post hook’ to that file (emailMyName- Low-cost email address - 1GB email storage - Block spam - Web & POP3 email access - Get your name as your email address) but it’s still not auto-updating.

When you “shell out” from PHP, the shell that gets used is extremely limited, by design. You may need to put an absolutely root-relative path to git, and you may also need to see what directory it’s running from. You can put other commands in the “back-ticks” to get that kind of info. Try <?php echo( shell_exec('pwd') ); ?> (print working directory) to see where it is executing from, and also try which git to see if it can even find the git binary from that context. I don’t think the back-ticks automatically echo, so that’s why I’m using shell_exec inside an echo statement above.

Walter

*Note: If I manually type ‘git pull’ via SSH everything gets updated nicely.

So either I put the file in the wrong directory or there’s some else amiss.

Here’s what the remote file structure looks like:

/public_html/
.git
resources/
css/
index.php
other-site-files.php
git-pull.php

Any ideas?

Todd
http://xiiro.com

Github has this notion of “hooks”, which are API calls that are automatically invoked whenever a new commit is pushed.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s most likely different. Every sysadmin has their own idea what to do in that respect. Back to your shell_exec script, look at what the pwd command returns. That would be the absolute path to your web root, beginning with a /.

Walter

On Sep 4, 2013, at 10:05 PM, Todd wrote:

I used my site but no luck. Is it possible the ‘/var/www/’ part is different on my server? Could that be the problem? Not sure where else to look for problems.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Interestingly that’s the path I tried without luck. This is very frustrating, I feel like I’m so close but still overlooking the obvious. It makes me want to stop shaving my head and grow my hair back just so I can pull it all out.

Todd

It’s most likely different. Every sysadmin has their own idea what to do in that respect. Back to your shell_exec script, look at what the pwd command returns. That would be the absolute path to your web root, beginning with a /.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Since you have ssh to this box, what do you see when you are cd’d into that folder and type pwd in your shell? If that’s different than what you get from PHP, try that instead.

Walter

On Sep 4, 2013, at 10:34 PM, Todd wrote:

Interestingly that’s the path I tried without luck. This is very frustrating, I feel like I’m so close but still overlooking the obvious. It makes me want to stop shaving my head and grow my hair back just so I can pull it all out.

Todd
http://xiiro.com

It’s most likely different. Every sysadmin has their own idea what to do in that respect. Back to your shell_exec script, look at what the pwd command returns. That would be the absolute path to your web root, beginning with a /.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

cd into /public_html/ yields the same path. Maybe there’s another setting in the script that’s causing a problem. It’s nutty.

Todd

Since you have ssh to this box, what do you see when you are cd’d into that folder and type pwd in your shell? If that’s different than what you get from PHP, try that instead.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Looking through that code – do you have PHP 5.4.latest there? There’s a lot of 5.4-isms in this that I’m not very familiar with.

Walter

On Sep 4, 2013, at 10:55 PM, Todd wrote:

cd into /public_html/ yields the same path. Maybe there’s another setting in the script that’s causing a problem. It’s nutty.

Todd
http://xiiro.com

Since you have ssh to this box, what do you see when you are cd’d into that folder and type pwd in your shell? If that’s different than what you get from PHP, try that instead.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options