Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
/ lambda-git Public archive

A git binary installed through NPM, for use with AWS Lambda

License

Notifications You must be signed in to change notification settings

pimterry/lambda-git

Open more actions menu

Repository files navigation

lambda-git

A git binary installed through NPM, for use with AWS Lambda.

Deprecated: this module isn't supported on AWS Linux 2 - you probably want to use git-lambda-layer instead. See #14 for further context.

To use this, just require it, and call it.

require("lambda-git")();

This call returns a Promise, and once it completes your Node process will be set up to run Git as a subprocess. lambda-git extracts a Lambda-built version of Git, updates the required environment variables to make it functional, and updates your process.env.PATH to make it accessible.

A larger example:

const { exec } = require('child_process');

require("lambda-git")()
	.then(function () {
		// git is now ready
        exec("git --version");
	})
	.catch(function (error) {
		// something failed
	});

If you want to do something more complicated, you can provide options to change this behaviour.

The Git binary itself comes from LambCI.

Changing the installation path:

require("lambda-git")({
    targetDirectory: "/tmp/alternate/path/git"
});

Managing env vars yourself:

require("lambda-git")({
    updateEnv: false
});
/* Returns:
{
    binPath: "/tmp/git/usr/bin",
    env: {
        GIT_TEMPLATE_DIR: '/tmp/git/usr/share/git-core/templates',
        GIT_EXEC_PATH: '/tmp/git/usr/libexec/git-core'
    }
} */

You'll need to extract these values and ensure they're made available to whatever process you're using to run Git.

About

A git binary installed through NPM, for use with AWS Lambda

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Morty Proxy This is a proxified and sanitized view of the page, visit original site.