Add git binaries to AWS Lambda layer.
Consider using git-lambda-layer instead, as it is compatible with all AWS runtimes (languages).
If you prefer to run git in a layer you have visibility (control) into run the following commands:
git clone https://github.com/lambci/git-lambda-layer.git
./publish.shIn case you are using the serverless framework, your git lambda layer can be created by using a serverless.yml file with the following contents:
service: git-lambda-layer
provider:
  name: aws
  region: us-east-1
layers:
  git:
    path: ../git-lambda-layer # using '.' clips first 2 characters
    description: Add git binaries to your lambda function
    licenseInfo: MIT
    allowedAccounts:
      - 'YOUR_AWS_ACCOUNT_ID' # use '*' to give permission to all AWS accounts
    package:
      artifact: layer.zipOnce your Lambda layer is created, it should be referenced in your lambda function.
This module allows loading git (version 2.13.5) as an AWS Lambda Layer so it can be used within you Lambda function (e.g. through simple-git).
$ npm install --save lambda-layer-gitFor security, traceability, or other reasons it might be preferable to deploy your own git Lambda layer.
Your git lambda layer can be created manually by:
- 
Compressing (zipping) the following folders/files: - bin
- nodejs
- LICENSE
- README.md
 
- 
Using the AWS CLI or AWS console to create your lambda layer and upload the zip file created in the previous step. 
In case you are using the serverless framework, your git lambda layer can be created by using a serverless.yml file with the following contents:
service: lambda-layer-git
provider:
  name: aws
  region: us-east-1
layers:
  git:
    path: ../lambda-layer-git # using '.' clips first 2 characters
    description: Add git binaries to your lambda function (git v2.13.5)
    compatibleRuntimes:
      - nodejs4.3
      - nodejs6.10
      - nodejs8.10
    licenseInfo: MIT
    allowedAccounts:
      - 'YOUR_AWS_ACCOUNT_ID' # use '*' to give permission to all AWS accounts
    package:
      exclude:
        - ./**
      include:
        - bin/**
        - nodejs/**
        - LICENSE
        - README.mdOnce your Lambda layer is created, it should be referenced in your lambda function.
Invoke the lambda-layer-git module as follows:
require("lambda-layer-git").prepareGit()
  .then(function () {
    // git is now ready
    // exec("git --version");
  })
  .catch(function (error) {
    // something failed
  });