31

I am successfully run()ning commands on remote server with my private key pair.

However, I'd like to do git clone ssh://private/repo on remote server using my local key (or using local ssh agent I'm in).

How to do it using fabric?

Almad
  • 5,753
  • 7
  • 35
  • 53

2 Answers2

56

Since version 1.4 fabric has environment option that enables agent forwarding.

env.forward_agent = True

UPD: This feature was buggy before fabric 1.4.2

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
1

The short answer is that fabric uses a forked version of paramiko and that paramiko doesn't support ssh agent forwarding.

The long answer is that there are issues for this both for fabric and paramiko. Even there's a comment in the fabric issue that contains links to a fork of both fabric and the forked paramiko version with ssh forwarding support. Hence, if you want to make use of that feature you'll need to get the latest version from there or wait for a while until it's officially released.

jcollado
  • 39,419
  • 8
  • 102
  • 133
  • 1
    @ReducedGosling I haven't used fabric for quite a while. You might want to have a look at the `forward_agent` configuration value in the [documentation](https://docs.fabfile.org/en/2.5/concepts/configuration.html#new-default-values-defined-by-fabric). – jcollado Dec 23 '19 at 06:17