在 Windows 8 上通过 cygwin 使用 git

9po*_*nt6 16 windows cygwin git permissions windows-8-preview

我有一个 Windows 8 开发预览(不确定它是否相关,但我从来没有在 w7 上遇到过这种麻烦)机器,我正在尝试从 github 克隆一个 git repo。

问题是我的 ~/.ssh/id_rsa 有 440 个权限,它需要是 400。我试过 chmodding 它,但对用户权限的任何更改都会反映在组权限中(即 chmod 600 导致 660 等)。这在整个文件系统中的任何文件中似乎都是不变的。

我试过搞乱 ACL 但无济于事(完全控制我的用户并拒绝每个人都导致 000)

这里有一些输出可以提供帮助:

$ git clone [removed]
Cloning into [removed]...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0660 for '/home/john/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/john/.ssh/id_rsa
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

$ ll ~/.ssh
total 6
-r--r----- 1 john None 1675 Nov 30 19:15 id_rsa
-rw-rw---- 1 john None  411 Nov 30 19:15 id_rsa.pub
-rw-rw-r-- 1 john None  407 Nov 30 18:43 known_hosts

$ chmod -v 400 ~/.ssh/id_rsa
mode of `/home/john/.ssh/id_rsa' changed from 0440 (r--r-----) to 0400 (r--------)

$ ll ~/.ssh
total 6
-r--r----- 1 john None 1675 Nov 30 19:15 id_rsa
-rw-rw---- 1 john None  411 Nov 30 19:15 id_rsa.pub
-rw-rw-r-- 1 john None  407 Nov 30 18:43 known_hosts

$ set | grep CYGWIN
CYGWIN='sbmntsec ntsec server ntea'
Run Code Online (Sandbox Code Playgroud)

我意识到我可以使用 msysgit 或其他东西,但我更喜欢能够从单个终端完成所有操作

编辑:出于同样的原因,Msysgit 也不起作用

小智 26

不需要空组。

在安装 cygwin 期间,所有文件都不属于任何组。您可以通过执行ls -al. 您将看到文件上没有组(“无”)。只需将其更改为用户:

chgrp Users *
Run Code Online (Sandbox Code Playgroud)

在此之后,您可以chmod随心所欲。