How to set executable bit on files deployed with Git from Windows?

300 views
Skip to first unread message

Sven

unread,
Jan 12, 2009, 5:09:39 PM1/12/09
to Capistrano
I'm deploying a Rails 2.2.2 app from Windows XP Pro using the msys
version of Git (version 1.5.6.1) and Capistrano v2.5.2. After
deploying, the files in my scripts folder lack execution permission.
With SVN this was dealt with by setting svn:executable. Is there a way
around this when working with Git?

Thanks,

Sven

Lee Hambley

unread,
Jan 12, 2009, 5:18:50 PM1/12/09
to capis...@googlegroups.com
Sven,

 There's nothing to stop you writing a task that grants the executable flag once the files have been deployed.

- Lee

2009/1/12 Sven <Sven...@gmail.com>

Sven

unread,
Jan 12, 2009, 6:25:24 PM1/12/09
to Capistrano
That's my fallback plan, but I was hoping to be able to represent the
permission coming out of the repository. If I can't, I can't.

Thanks,

Sven

On Jan 12, 5:18 pm, "Lee Hambley" <lee.hamb...@gmail.com> wrote:
> Sven,
>  There's nothing to stop you writing a task that grants the executable flag
> once the files have been deployed.
>
> - Lee
>
> 2009/1/12 Sven <Sven....@gmail.com>

Lee Hambley

unread,
Jan 12, 2009, 6:33:09 PM1/12/09
to capis...@googlegroups.com
Sven,

I'm pretty sure thats not possible with GIT, I recall seeing Torvalds' keynote on git (try TED.com) and he was harping on about how there wasn't a need for such a thing in SCM (why would your SCM care if your file is supposed to be executable?) - but that it was possible to hook this in with behaviors after the checkout/update was complete.

A command to update that property on the file with Capistrano would be trivial!

- Lee

2009/1/12 Sven <Sven...@gmail.com>

Sven

unread,
Jan 12, 2009, 8:37:58 PM1/12/09
to Capistrano
You know, as I think about it I guess that jibes with the notion of
not versioning directories in Git. I'll go ahead with the Capistrano
task. Thanks for your thoughts, Lee!

-Sven

On 12 Jan, 18:33, "Lee Hambley" <lee.hamb...@gmail.com> wrote:
> Sven,
> I'm pretty sure thats not possible with GIT, I recall seeing Torvalds'
> keynote on git (try TED.com) and he was harping on about how there wasn't a
> need for such a thing in SCM (why would your SCM care if your file is
> supposed to be executable?) - but that it was possible to hook this in
> with behaviors after the checkout/update was complete.
>
> A command to update that property on the file with Capistrano would be
> trivial!
>
> - Lee
>
> 2009/1/12 Sven <Sven....@gmail.com>

David Masover

unread,
Jan 12, 2009, 11:30:29 PM1/12/09
to capis...@googlegroups.com
I'm fairly sure that Git stores the entire Unix file permission mask. (On files, obviously, not directories.)

In fact, here's a simple test, on Unix:

dave@serenity:~$ mkdir foo
dave@serenity:~$ cd foo
dave@serenity:~/foo$ git init
Initialized empty Git repository in /home/dave/foo/.git/
dave@serenity:~/foo$ touch a
dave@serenity:~/foo$ ls -l a
-rw-r--r-- 1 dave dave 0 2009-01-12 22:29 a
dave@serenity:~/foo$ git add a
dave@serenity:~/foo$ git commit
Created initial commit ad1cedb: Initial commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a
dave@serenity:~/foo$ chmod +x a
dave@serenity:~/foo$ git commit -a
Created commit 1e846b4: New mask
 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 a
dave@serenity:~/foo$

I'm not sure how to fix it on Windows, but the repository definitely stores permissions.

Lee Hambley

unread,
Jan 13, 2009, 5:06:45 AM1/13/09
to capis...@googlegroups.com
David,

Thanks for chipping in - I had a feeling i'd heard that roumer, but I couldn't find any evidence of it on Google last night when replying to Sven,

Sven, to get what you need out of this, you might need to log onto the server, set the executable bit, and commit from there into your repository.

What David is saying makes perfect sense, after all, Git was designed for SCM of the Kernel and its associated files and tools.

- Lee

2009/1/13 David Masover <da...@3mix.com>

David Masover

unread,
Jan 14, 2009, 11:21:06 AM1/14/09
to capis...@googlegroups.com
Of course, my own solution (aside from just not using Windows) would be a bit more convoluted:

Either try something like Cygwin (assuming it can set and preserve permissions), or have a Unix-like machine (or virtual machine) available -- work over Samba, check files in over SSH (rather than trying to use Git on Windows).

I imagine there's a real solution somewhere, though.
Reply all
Reply to author
Forward
0 new messages