# git-win

> Install Git for Windows by npm.

Latest version **2.3.0** (published 2018-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-win
pnpm add git-win
yarn add git-win
bun add git-win
```

## 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.3.0 |
| Published | 2018-12-21 |
| First published | 2016-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 167.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | gucong3000 |
| Maintainers | gucong |
| Keywords | git, window, resolve, path, posix |

## Links

- npm: https://www.npmjs.com/package/git-win
- Repository: https://github.com/gucong3000/git-win
- Homepage: https://github.com/gucong3000/git-win#readme
- Issues: https://github.com/gucong3000/git-win/issues
- npm.io page: https://npm.io/package/git-win

## Dependencies (5)

- [got](https://npm.io/package/got.md) ^9.5.0
- [in-gfw](https://npm.io/package/in-gfw.md) ^1.2.0
- [nugget](https://npm.io/package/nugget.md) ^2.0.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.2.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.3.0 (latest) — 2018-12-21
- 2.2.5 — 2018-12-09
- 2.2.4 — 2018-11-28
- 2.2.3 — 2018-11-23
- 2.2.2 — 2018-11-23
- 2.2.1 — 2018-11-22
- 2.2.0 — 2018-11-21
- 2.1.1 — 2018-11-21
- 2.1.0 — 2018-11-15
- 2.0.0 — 2018-11-09
- 1.6.3 — 2018-08-30
- 1.6.2 — 2018-06-25
- 1.6.1 — 2018-05-07
- 1.6.0 — 2018-05-02
- 1.5.7 — 2018-04-26
- … 17 more at https://npm.io/package/git-win/versions

## README

git-win
===========

[![NPM version](https://img.shields.io/npm/v/git-win.svg?style=flat-square)](https://www.npmjs.com/package/git-win)
[![AppVeyor](https://img.shields.io/appveyor/ci/gucong3000/git-win.svg)](https://ci.appveyor.com/project/gucong3000/git-win)
[![codecov](https://img.shields.io/codecov/c/github/gucong3000/git-win.svg)](https://codecov.io/gh/gucong3000/git-win)
[![David](https://img.shields.io/david/gucong3000/git-win.svg)](https://david-dm.org/gucong3000/git-win)

Install [Git for Windows](https://gitforwindows.org/) by npm.

## Why

- Show path of Git in your disk.
- Install Git when you have not installed.
- Silent installation Git.

## Install

Install [Git for Windows](https://gitforwindows.org/) from mirror

```bash
npm i -g git-win --git4win_mirror=https://npm.taobao.org/mirrors/git-for-windows
```

Install [Git for Windows](https://gitforwindows.org/) for specify version whith [flags to use by calling the installer](https://github.com/git-for-windows/git/wiki/Silent-or-Unattended-Installation)

```bash
npm i -g git-win --git-version=2.19 -- /COMPONENTS="icons,icons\\quicklaunch,ext,ext\\shellhere,ext\\guihere,assoc,assoc_sh"
```

## Usage

```js
const gitWin = require("git-win");

gitWin.toPosix("C:/Program Files/Git/bin/bash");	// `/bin/bash`
gitWin.toPosix("C:/Program Files/Git/mingw000");	// `/mingw64`
gitWin.toPosix("C:/Users");				// `/c/Users`

gitWin.toWin32("~/xxxxxxx");	// `%HOME%\xxxxxxx`
gitWin.toWin32("/bin/bash");	// `C:\Program Files\Git\usr\bin\bash`
gitWin.toWin32("/mingw000");	// `C:\Program Files\Git\mingw64`
gitWin.toWin32("/tmp/xxxx");	// `C:\Users\****\AppData\Local\Temp\xxxx`
```

## API

### gitWin.root

Show install directory of Git

### gitWin.resolve([...paths])

The `gitWin.resolve()` method resolves a sequence of paths into an path.
- `/mingw32` path prefix will be convert to real path name
- [The cygdrive path prefix](https://cygwin.com/cygwin-ug-net/using.html#cygdrive) will be convert to Windows drive path
- Git/Cygwin install directory path prefix will be convert to root path

### gitWin.toWin32([...paths])

Base on `gitWin.resolve()` but return an Windows style path.
- Support for [the Cygwin mount table](https://cygwin.com/cygwin-ug-net/using.html#mount-table)
- POSIX style root path will be convert to Git install directory
- tilde path prefix will be convert to `%HOME%`

### gitWin.toPosix([...paths])

Base on `gitWin.resolve()` but return an POSIX style path.
- Drive path prefix will be convert to [The cygdrive path prefix](https://cygwin.com/cygwin-ug-net/using.html#cygdrive)

### gitWin.mingw

Show directory name of MinGW

### gitWin.cygdrive

Show cygdrive path prefix

### gitWin.mount

Show [the Cygwin mount table](https://cygwin.com/cygwin-ug-net/using.html#mount-table)

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