Search code examples
gitcygwinsourcetree

Problems cloning projects with Cygwin's Git


When I try to clone projects using Cygwin's Git 2.7.0 I'm having some issues related to permissions. This is, every time I try running one of the cloned project's executables I'm getting the next error:

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.

If I instead use Cygwin's Git, the one included in Attlasian SourceTree, projects will be cloned "properly", and I won't be getting any issue. Below I list both Git's global configurations:

Cygwin's Git (2.7.0):

[email protected]
user.name=foo
alias.default=!git add -A && git commit -m 'default commit'
core.filemode=false
core.autocrlf=true

SourceTree's Git (Git version 1.9.5.msysgit.0):

user.name=foo
[email protected]
core.autocrlf=true
core.filemode=false

How can I configure Cygwin's Git (or other stuff) properly to avoid having such permissions issues?


Solution

  • That reminds me of Alexpux/MSYS2-packages issue 222:

    On Linux if you want to execute a file it must have the correct permissions. By default a touched file will not have this, for security reasons.

    However Windows has a wrong-headed take on this, in that a file created with New > Text Document automatically has execute permissions.

    So what looks to have happened in this case is that whoever created the batch files did so in a MSYS2 environment, hence the correct lack of execute permissions.
    What they did not do is chmod +x to correctly give these files execute permission, as would have been done if the files were created with Windows native tools.

    So a simple chmod +x should be enough.

    And then, with Git 2.9.1 or more:

    git add --chmod=+x -- afile