Skip to content

Commit 9706cd1

Browse files
authored
fix: handle GPG sign git config for initial commit (#5823)
Fixes #5818
1 parent 27db6bf commit 9706cd1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/@vue/cli/lib/Creator.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,22 @@ module.exports = class Creator extends EventEmitter {
248248

249249
// commit initial state
250250
let gitCommitFailed = false
251+
let gpgSign = false
251252
if (shouldInitGit) {
252253
await run('git add -A')
253254
if (isTestOrDebug) {
254255
await run('git', ['config', 'user.name', 'test'])
255256
await run('git', ['config', 'user.email', '[email protected]'])
257+
await run('git', ['config', 'commit.gpgSign', 'false'])
256258
}
259+
gpgSign = await (async () => {
260+
const { stdout: gpgSignConfig } = await run('git', [
261+
'config',
262+
'--get',
263+
'commit.gpgSign'
264+
])
265+
return gpgSignConfig === 'true'
266+
})()
257267
const msg = typeof cliOptions.git === 'string' ? cliOptions.git : 'init'
258268
try {
259269
await run('git', ['commit', '-m', msg, '--no-verify'])
@@ -277,7 +287,7 @@ module.exports = class Creator extends EventEmitter {
277287

278288
if (gitCommitFailed) {
279289
warn(
280-
`Skipped git commit due to missing username and email in git config.\n` +
290+
`Skipped git commit due to missing username and email in git config${gpgSign ? ' or failed to sign commit' : ''}.\n` +
281291
`You will need to perform the initial commit yourself.\n`
282292
)
283293
}

0 commit comments

Comments
 (0)