36

Windows XP マシンで GIT を構成しようとしていますが、SSH は無意味な場所 (/.ssh/id_rsa など) で公開鍵と秘密鍵のペアを作成して探し続けます。

Windows 用の GIT インストールに構成ファイルがあり、これを自分のホーム ディレクトリまたは別のユーザー定義の場所に切り替えることができますか? デフォルトでは、//.ssh/id_rsa に新しいキー ペアを作成するよう提案されますが、「ディレクトリ '//.ssh' を作成できませんでした」というエラーが表示されます。そして、作成できるディレクトリを見つけることができても、GIT はそこを検索しません。

4

7 に答える 7

74

WindowsXPでホームディレクトリを手動で設定する方法を理解しました。

  1. 「マイコンピュータ」を右クリック
  2. 「詳細」タブを選択します
  3. 「環境変数」ボタンをクリックします
  4. [システム変数]セクションで、[新規]をクリックします
  5. 「変数名」に「ホーム」と入力します。
  6. [変数値]に、プロファイルへのパスを入力します。

コマンドプロンプトで同じことを行うには、次のようにします。

setx HOME "your\path\to\home"

(接尾辞xに注意してください-これは変更を永続化するために使用されます)

于 2010-05-15T16:45:33.307 に答える
9

MSYS2 から推奨される方法は、ホーム ディレクトリに設定db_homeすることです。/etc/nsswitch.conf

正しい方向を示してくれた @VarunAgwのおかげです。

Git-for-Windows には が含まenvれており、 bash 変数db_homeを読み取る必要がありますが、信頼性は低くなります。HOME

于 2016-08-10T16:14:52.153 に答える
3

Windows 7 でも同様の問題が発生していました。HOME環境変数が正しく設定されているようです。

$ echo $HOME
C:\Users\craibuc

sshただし、github のアクセスをテストするために接続しようとすると失敗しました。

$ ssh -Tv git@github.com
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
Could not create directory 'C/.ssh'.
debug1: identity file C/.ssh/id_rsa type -1
debug1: identity file C/.ssh/id_rsa-cert type -1
debug1: identity file C/.ssh/id_dsa type -1
debug1: identity file C/.ssh/id_dsa-cert type -1
debug1: identity file C/.ssh/id_ecdsa type -1
debug1: identity file C/.ssh/id_ecdsa-cert type -1
debug1: identity file C/.ssh/id_ed25519 type -1
debug1: identity file C/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (C/.ssh/known_hosts).
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: C/.ssh/id_rsa
debug1: Trying private key: C/.ssh/id_dsa
debug1: Trying private key: C/.ssh/id_ecdsa
debug1: Trying private key: C/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

何らかの理由で、sshにアクセスしようとしていましたC/.ssh

setx HOME /c/users/craibucシェルを使用して変数を設定し、再起動すると、接続できました。

$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
Hi craibuc! You've successfully authenticated, but GitHub does not provide shell access.
于 2014-12-09T13:53:30.833 に答える
0

ユーザー プロファイルをネットワーク ドライブ (この場合は にマップ) に設定するドメイン ポリシーを使用してマシンを使用しているときに、同じ種類の問題が発生しましたZ:

Powershell から何かをしようとすると、次のようなメッセージが表示されます。PATH 変数の設定homeは役に立ちませんでした。

git clone ssh://myusername@mydomain.com:1234/myproject
Cloning into 'myproject'...
Could not create directory '/z/.ssh'.
The authenticity of host '[mydomain.com]:1234 ([1.1.1.1]:1234)' can't be established.
RSA key fingerprint is 00:11:22:33:$4:55:66:77:88.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/z/.ssh/known_hosts).
Permission denied (publickey).

Please make sure you have the correct access rights
and the repository exists.

git bash からクローンを作成したときは、etc がシェルから/z/.sshポイントする有効な方法であるため、問題ありませんでした。Z:\.ssh

于 2015-03-23T13:50:34.667 に答える
-3

Windows 7の場合、秘密鍵(id_rsa)をC:\ Users \ .sshフォルダー内に配置するだけです。.sshフォルダーが存在しない場合は、作成するだけです。GIT for Windowsをダウンロードし、プロジェクトディレクトリに挿入して、git clone ssh://@/。gitを実行します。

于 2011-07-15T09:52:52.413 に答える