Skip to content

ssh support #16

@moshir

Description

@moshir

Hi,

i've been trying to use lambda-git and it's been working great locally.
When using it in lambda, as i'm using ssh keys, the lambda fails with

Could not create directory '/home/sbx_user1051/.ssh'.\r\nFailed to add the host to the list of known hosts (/home/sbx_user1051/.ssh/known_hosts)

The id_rsa file is saved before the git command is issued in the /tmp/ folder.

The problem could be reproduced as follows , assuming the lambda has been packaged including lambda-git:

import git 
import os
env={
    "GIT_SSH_COMMAND": "ssh -i {} -o StrictHostKeyChecking=no".format("/tmp/id_rsa"),
    "HOME" : "/tmp/me"
}
def handler(event):
    git.exec_command('checkout', repo, "master", cwd="/tmp/repositories/",env=env)

which runs fine locally, but results in the exception mentionned above when run in lambda.

Environment

  • aws lambda
  • runtime : python 2.7
  • virtualenv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions