gpt4 book ai didi

git - 使用 Cygwin 的 Git 克隆项目时出现问题

转载 作者:太空狗 更新时间:2023-10-29 14:11:48 25 4
gpt4 key购买 nike

当我尝试使用 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 中,项目将被“正确地”克隆,并且我不会遇到任何问题。下面我列出了 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

关于git - 使用 Cygwin 的 Git 克隆项目时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38746110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com