Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 我可以将ssh私钥永久添加到我的用户代理吗?_Git_Ssh_Git Bash_Ssh Keys_Ssh Agent - Fatal编程技术网

Git 我可以将ssh私钥永久添加到我的用户代理吗?

Git 我可以将ssh私钥永久添加到我的用户代理吗?,git,ssh,git-bash,ssh-keys,ssh-agent,Git,Ssh,Git Bash,Ssh Keys,Ssh Agent,有点像noob问题,但每天在工作中,当我打开gitbash时,我必须启动ssh代理守护进程,并且必须将ssh私钥添加到用户代理中,以便Github知道我是谁 eval“$(ssh代理-s)” ssh add~/.ssh/id\u rsa 如果我不这样做,我就不能拉/推github 每天都要这样做会有点烦人,有没有办法永久添加它?不要使用ssh代理,而是将以下内容放在.ssh/config文件中: Host github.com IdentityFile ~/.ssh/id_rsa 代理

有点像noob问题,但每天在工作中,当我打开gitbash时,我必须启动ssh代理守护进程,并且必须将ssh私钥添加到用户代理中,以便Github知道我是谁

  • eval“$(ssh代理-s)”
  • ssh add~/.ssh/id\u rsa
  • 如果我不这样做,我就不能拉/推github


    每天都要这样做会有点烦人,有没有办法永久添加它?

    不要使用
    ssh代理
    ,而是将以下内容放在
    .ssh/config
    文件中:

    Host github.com
        IdentityFile ~/.ssh/id_rsa
    

    代理主要用于避免在
    .ssh/config
    中创建大量配置(因为任何连接都会尝试使用代理中找到的密钥),或者允许远程ssh会话返回到本地计算机以获取必要的密钥。

    ,您只需将这两个命令放入
    .bash\u配置文件
    .bashrc
    。我不知道Git bash将运行或运行在什么样的环境中,因此可能需要做一些更复杂的事情来避免运行多个
    ssh代理实例。