Cygwin的Git克隆项目时出现问题 [英] Problems cloning projects with Cygwin's Git
问题描述
当我尝试使用Cygwin的Git 2.7.0克隆项目时,出现了一些与权限相关的问题.也就是说,每次我尝试运行克隆项目的可执行文件之一时,都会遇到下一个错误:
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无法访问指定的设备,路径或文件.您可能没有适当的权限来访问该项目.
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
如果我改用Cygwin的Git,即Attlasian SourceTree中包含的Git,则将正确"克隆项目,而我不会遇到任何问题.下面,我列出了两个Git的全局配置:
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的Git(2.7.0):
Cygwin's Git (2.7.0):
user.email=foo@foo.com
user.name=foo
alias.default=!git add -A && git commit -m 'default commit'
core.filemode=false
core.autocrlf=true
SourceTree的Git(Git版本1.9.5.msysgit.0):
SourceTree's Git (Git version 1.9.5.msysgit.0):
user.name=foo
user.email=foo@foo.com
core.autocrlf=true
core.filemode=false
如何正确配置Cygwin的Git(或其他工具),以避免出现此类权限问题?
How can I configure Cygwin's Git (or other stuff) properly to avoid having such permissions issues?
推荐答案
这使我想起 Alexpux/MSYS2-程序包发行222 :
在Linux上,如果要执行文件,则它必须具有正确的权限. 出于安全原因,默认情况下,触摸的文件将不具有此功能.
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.
但是Windows对此有错误的看法,因为使用 新建>文本文档自动具有执行权限.
However Windows has a wrong-headed take on this, in that a file created with New > Text Document automatically has execute permissions.
因此,在这种情况下发生的事情是,创建批处理文件的人都是在MSYS2环境中这样做的,因此正确缺乏执行
权限.
他们没有做的是chmod +x
正确提供这些文件
执行权限,就像使用以下命令创建文件时一样
Windows本机工具.
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.
所以简单的chmod +x
就足够了.
然后,使用Git 2.9.1或更高版本:
git add --chmod=+x -- afile
这篇关于Cygwin的Git克隆项目时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!