aws / git-remote-codecommit

An implementation of Git Remote Helper that makes it easier to interact with AWS CodeCommit
Apache License 2.0
272 stars 39 forks source link

git-remote-codecommit error in aws python lambda function #31

Open yogeshshivnekar7 opened 3 years ago

yogeshshivnekar7 commented 3 years ago

I have to clone a repository from code commit in my lambda function. the script is working properly in local machine with same iam role and python packages. i added the python package layer in lambda function its giving me below error.

START RequestId: e5350a8f-b998-4360-9cbb-85af8772e88a Version: $LATEST [ERROR] GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git clone -v --branch=main codecommit::us-east-1://]reponame /tmp/test/ stderr: 'Cloning into '/tmp/test'... git: 'remote-codecommit' is not a git command. See 'git --help'. ' Traceback (most recent call last):

repo = git.Repo.clone_from( 'codecommit::us-east-1://reponame', '/tmp/test/', branch='main' )

oleksii-donoha commented 3 years ago

Similar problem happened to me when path to git-remote-codecommit executable was not in PATH env variable. Check your PATH, maybe that will help

yogeshshivnekar7 commented 3 years ago

I got the above error in aws lambda function.

oleksii-donoha commented 3 years ago

GitPython uses git executable under the hood, so I would assume it looks for git-remote-codecommit in same places as plain git. AFAIK lambda layers are unpacked to /opt inside the execution environment, you can check whether PATH includes that directory