Skip to content

Commit 3ac4bc7

Browse files
hotfix: git --local causing fatal error during mcdev upgrade
1 parent 415b4df commit 3ac4bc7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/util/init.git.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,14 @@ const Init = {
236236
// name can contain spaces - wrap it in quotes
237237
const name = `"${responses.name.trim()}"`;
238238
const email = responses.email.trim();
239-
Util.execSync('git', ['config', '--local', 'user.name', name]);
240-
Util.execSync('git', ['config', '--local', 'user.email', email]);
239+
try {
240+
Util.execSync('git', ['config', '--local', 'user.name', name]);
241+
Util.execSync('git', ['config', '--local', 'user.email', email]);
242+
} catch (ex) {
243+
// if project folder is not a git folder then using --local will lead to a fatal error
244+
Util.logger.warn('- Could not update git user name and email');
245+
Util.logger.debug(ex.message);
246+
}
241247
}
242248
},
243249
/**

0 commit comments

Comments
 (0)