使用 Cygwin Git 克隆项目时出现问题
Problems cloning projects with Cygwin's Git
当我尝试使用 Cygwin 的 Git 2.7.0 克隆项目时,我遇到了一些与权限相关的问题。也就是说,每次我尝试 运行 一个克隆项目的可执行文件时,我都会遇到下一个错误:
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
如果我改为使用 Cygwin 的 Git,它包含在 Attlasian SourceTree 中,项目将被克隆 "properly",我不会遇到任何问题。下面我列出了 Git 的全局配置:
Cygwin 的 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):
user.name=foo
user.email=foo@foo.com
core.autocrlf=true
core.filemode=false
如何正确配置 Cygwin 的 Git(或其他东西)以避免出现此类权限问题?
这让我想起了 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.
那么一个简单的chmod +x
就足够了。
然后,with Git 2.9.1 or more:
git add --chmod=+x -- afile
当我尝试使用 Cygwin 的 Git 2.7.0 克隆项目时,我遇到了一些与权限相关的问题。也就是说,每次我尝试 运行 一个克隆项目的可执行文件时,我都会遇到下一个错误:
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
如果我改为使用 Cygwin 的 Git,它包含在 Attlasian SourceTree 中,项目将被克隆 "properly",我不会遇到任何问题。下面我列出了 Git 的全局配置:
Cygwin 的 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):
user.name=foo
user.email=foo@foo.com
core.autocrlf=true
core.filemode=false
如何正确配置 Cygwin 的 Git(或其他东西)以避免出现此类权限问题?
这让我想起了 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 ischmod +x
to correctly give these files execute permission, as would have been done if the files were created with Windows native tools.
那么一个简单的chmod +x
就足够了。
然后,with Git 2.9.1 or more:
git add --chmod=+x -- afile