5

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 ?

Evg
  • 2,698
  • 4
  • 38
  • 56

1 Answers1

3

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.

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755