【发布时间】:2016-09-19 08:12:36
【问题描述】:
我想将一个项目推送到 github 主页。因此,我正在尝试为 github 创建 ssh-key 来管理它,但我面临的问题是 git 在错误的目录 /c/Users/user82/.ssh/id_rsa) 而不是在项目目录 /desktop/dogs 中创建 ssh-key。
如何告诉 Git 在项目目录中也创建 ssh-key /desktop/dogs 而不是在此目录中创建 c/Users/user82?
user82@User MINGW64 ~/desktop/dogs (master)
$ ssh-keygen -t rsa -C "example@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/user82/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/user82/.ssh/id_rsa.
Your public key has been saved in /c/Users/user82/.ssh/id_rsa.pub.
【问题讨论】:
-
ssh-keygen 将密钥放在默认目录下,没有错。 Git 与此设置无关。为什么要移动项目目录中的键?您不需要将项目推送到 github。 Git 使用 ssh 客户端,ssh 客户端应该知道你的密钥的默认位置而不做任何事情。
-
而且,无论如何,如果您想将文件放在其他位置,请自行移动?