任何人都知道如何设置它,所以当我在命令行中,当我push/pull
进出git存储库时,我不必输入我的用户名和密码?
感谢。
答案 0 :(得分:4)
当您使用http/https
作为转移协议时,系统会要求您username
&每次password
。
切换到ssh键,您将不再被问到。
以下示例是如何为GitHub设置密钥,但对于大多数具有微小更改(GUI)的服务器,我将是相同的。
流程仍然相同
git://
)Here is how to set it up:
强> 生成一个新的ssh密钥(如果您已经有一个密钥,则跳过此步骤)
ssh-keygen -t rsa -C "your@email"
将密钥设置在home/.ssh
目录(或Windows下的Users/<your user>.ssh
)后,打开它并将内容复制到中央存储库下的相关部分(ssh密钥)。 / p>
For more information about the transport protocols read this:
强> How to set up ssh key under your GitHub account?
强> 现在它应该工作
Note
强> 首次设置打开终端并运行git fetch
后,密钥将被测试并添加到您的known hosts
文件中。