简体   繁体   English

git Permission denied(publickey),在每个连接上

[英]git Permission denied (publickey), on every connect

I try to simplify my work with git, then i try to pull my repository with 我尝试用git简化我的工作,然后我尝试用我的存储库

git pull

i get "Permission denied (publickey), i solve this by two commands: 我得到“权限被拒绝(publickey),我通过两个命令解决这个问题:

1. ssh-agent /bin/bash 

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

Enter passphrase for /root/.ssh/mukey * - now i cat use "git pull" 输入/root/.ssh/mukey *的密码 - 现在我使用“git pull”

but then i connect next time via ssh i must reenter this two commands again and again 但是我下次通过ssh连接时我必须一次又一次地重新输入这两个命令

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. 一个ssh配置文件,指定ssh连接的所有详细信息。

     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 . .bashrc.profile添加代理和ssh-add命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM