Skip to content

Commit c32d43d

Browse files
committed
fix: fix initializing git repo
1 parent b02d73a commit c32d43d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/create-react-native-library/src/utils/initialCommit.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ export async function createInitialGitCommit(
44
folder: string,
55
signal?: AbortSignal
66
) {
7-
const isInGitRepo =
8-
(await spawn('git', ['rev-parse', '--is-inside-work-tree'], {
9-
cwd: folder,
10-
signal,
11-
})) === 'true';
7+
let isInGitRepo = false;
8+
9+
try {
10+
isInGitRepo =
11+
(await spawn('git', ['rev-parse', '--is-inside-work-tree'], {
12+
cwd: folder,
13+
signal,
14+
})) === 'true';
15+
} catch (error) {
16+
// Ignore errors
17+
}
1218

1319
if (!isInGitRepo) {
1420
await spawn('git', ['init'], { cwd: folder, signal });

0 commit comments

Comments
 (0)