# gitinfo

> Gets information about a Git repository.

Latest version **2.4.0** (published 2019-07-13) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install gitinfo
pnpm add gitinfo
yarn add gitinfo
bun add gitinfo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2019-07-13 |
| First published | 2012-09-18 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 46 |
| Author | Gajus Kuizinas |
| Maintainers | gajus |
| Keywords | github, repository, info |

## Links

- npm: https://www.npmjs.com/package/gitinfo
- Repository: https://github.com/gajus/gitinfo
- Homepage: https://github.com/gajus/gitinfo#readme
- Issues: https://github.com/gajus/gitinfo/issues
- npm.io page: https://npm.io/package/gitinfo

## Dependencies (2)

- [ini](https://npm.io/package/ini.md) ^1.3.5
- [ramda](https://npm.io/package/ramda.md) ^0.26.1

## Recent versions

- 2.4.0 (latest) — 2019-07-13
- 2.3.0 — 2019-07-12
- 2.2.0 — 2017-07-20
- 2.1.14 — 2016-09-05
- 2.1.13 — 2016-09-05
- 2.0.85 — 2016-08-23
- 2.0.84 — 2016-08-22
- 2.0.5 — 2016-08-22
- 2.0.4 — 2016-08-22
- 2.0.3 — 2016-08-15
- 2.0.2 — 2016-08-15
- 2.0.1 — 2016-08-09
- 2.0.0 — 2016-08-09
- 1.3.0 — 2016-08-09
- 1.2.2 — 2015-10-26
- … 11 more at https://npm.io/package/gitinfo/versions

## README

# gitinfo

[![Travis build status](http://img.shields.io/travis/gajus/gitinfo/master.svg?style=flat-square)](https://travis-ci.org/gajus/gitinfo)
[![NPM version](http://img.shields.io/npm/v/gitinfo.svg?style=flat-square)](https://www.npmjs.org/package/gitinfo)
[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)

Gets information about Git repository.

## Implementation

gitinfo reads the contents of the `./git` directory to extract information.

## API

```js
import createGitinfo from 'gitinfo';

/**
 * @typedef Configuration
 * @property {string} [defaultBranchName] Default branch name to fallback to. Default: throws an error if branch cannot be resolved.
 * @property {string} [gitPath] Path used to resolve .git path. Defaults to `__dirname`.
 */

/**
 * @access public
 * @name createGitinfo
 * @param {Configuration} userConfig
 */
const gitinfo = createGitinfo();

/**
 * Returns **Any** GitHub repository URL.
 */
gitinfo.getGithubUrl();

/**
 * Returns **Any** Name of the current branch.
 */
gitinfo.getBranchName();

/**
 * Returns **Any** Remote URL of the current branch.
 */
gitinfo.getRemoteUrl();

/**
 * Returns **Any** Absolute path to the .git/ directory.
 */
gitinfo.getGitPath();

/**
 * Returns **Any** Username of the repository author.
 */
gitinfo.getUsername();

/**
 * Returns **Any** Repository name.
 */
gitinfo.getName();

/**
 * Returns **Any** Commit SHA of the current branch.
 */
gitinfo.getHeadSha();

/**
 * Returns **Any** Representation of the .git/config file.
 */
gitinfo.getConfig();

```

## Download

Download using NPM:

```sh
npm install gitinfo

```

---
_Source: https://npm.io/package/gitinfo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
