Skip to content

Commit a7d39c2

Browse files
authored
Merge pull request #822 from steveukx/docs/english-locale
English locale docs
2 parents 7b46340 + 21fd03c commit a7d39c2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/NON_ENGLISH_LOCALE.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Non-English Locales
2+
3+
Some `simple-git` tasks return the `stdout` of the `git` binary directly (for example `git.raw()`)
4+
whereas some parse the `stdout` to pick out the useful data and build a structured response
5+
(for example `git.branchLocal()` which returns a `BranchSummary`).
6+
7+
If your locale is set to any language other than English, please ensure you use the `LANG` and
8+
`LC_ALL` environment variables to ensure the `simple-git` parsers match correctly:
9+
10+
```typescript
11+
import { simpleGit } from 'simple-git';
12+
13+
const git = simpleGit().env({
14+
LANG: 'C',
15+
LC_ALL: 'C',
16+
});
17+
const branches = await git.branchLocal();
18+
```
19+
20+
> I've set a locale environment variable and now my auth is failing
21+
22+
`simple-git` uses a `ChildProcess` to run the `git` commands, which will uses the same environment
23+
variables available in the node process running your script. When the environment variables are
24+
customised though, only those variables are available in the `git` process.
25+
26+
If you are relying on `GIT_*` (or any other) environment variables to make `git` function
27+
correctly, ensure you pass those through as well:
28+
29+
```typescript
30+
import { simpleGit } from 'simple-git';
31+
32+
const git = simpleGit().env({
33+
...process.env,
34+
LANG: 'C',
35+
LC_ALL: 'C',
36+
});
37+
const branches = await git.branchLocal();
38+
```
39+

0 commit comments

Comments
 (0)