git Permission denied(publickey),在每个连接上 [英] git Permission denied (publickey), on every connect

查看:678
本文介绍了git Permission denied(publickey),在每个连接上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用git来简化我的工作,然后我试着把我的存储库与

  git pull 

我得到Permission denied(publickey),我通过两条命令解决了这个问题:

  1. ssh-agent / bin / bash 

2. ssh-add /root/.ssh/mykey

为/root/.ssh/mukey * 输入密码短语 - 现在我使用git pull



然后我通过ssh连接下一次我必须重复输入这两个命令



如何使它会自动初始化跳过这一步?

解决方案

您应该拥有:


  • 一个ssh配置文件,指定您的ssh连接的所有详细信息。

      cat 〜/ .ssh / config 

    主机yourserver
    主机名upstream.server.com
    用户git#或用于服务器的正确用户帐户
    IdentityFile / root /.ssh/mykey

    $ g $ git remote set -p $ p $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ g $ gg remote set- url origin ssh:// yourserver:yourRepo.git


  • 添加代理和<$ c在 .bashrc .profile 中使用$ c> ssh-add 命令。



I try to simplify my work with git, then i try to pull my repository with

git pull

i get "Permission denied (publickey), i solve this by two commands:

1. ssh-agent /bin/bash 

2. ssh-add /root/.ssh/mykey

Enter passphrase for /root/.ssh/mukey * - now i cat use "git pull"

but then i connect next time via ssh i must reenter this two commands again and again

how to make it auto init to skip this steps ?

解决方案

You should have:

  • an ssh config file specifying all the details of your ssh connection.

    cat ~/.ssh/config
    
    Host yourserver
    Hostname upstream.server.com
    User git                          # or the right user account to use on your server
    IdentityFile /root/.ssh/mykey
    

  • change the remote url

    git remote set-url origin ssh://yourserver:yourRepo.git
    

  • add the agent and ssh-add command in your .bashrc or .profile.

这篇关于git Permission denied(publickey),在每个连接上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆