From 9defca0c73a9cb28155958b84b65ec14fe00956e Mon Sep 17 00:00:00 2001 From: Spenser Black <spenserblack01@gmail.com> Date: Wed, 26 Aug 2020 09:26:42 -0400 Subject: [PATCH 1/2] fix(initial commit): Expand warning on gpgSign If git config `commit.gpgSign` is `true`, warning will be expanded to also say that failed commit may be due to failure to sign commit. Addresses #5818 --- packages/@vue/cli/lib/Creator.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/@vue/cli/lib/Creator.js b/packages/@vue/cli/lib/Creator.js index a443b338b3..4391558eed 100644 --- a/packages/@vue/cli/lib/Creator.js +++ b/packages/@vue/cli/lib/Creator.js @@ -248,12 +248,21 @@ module.exports = class Creator extends EventEmitter { // commit initial state let gitCommitFailed = false + let gpgSign = false if (shouldInitGit) { await run('git add -A') if (isTestOrDebug) { await run('git', ['config', 'user.name', 'test']) await run('git', ['config', 'user.email', 'test@test.com']) } + gpgSign = await (async () => { + const { stdout: gpgSignConfig } = await run('git', [ + 'config', + '--get', + 'commit.gpgSign' + ]) + return gpgSignConfig === 'true' + })() const msg = typeof cliOptions.git === 'string' ? cliOptions.git : 'init' try { await run('git', ['commit', '-m', msg, '--no-verify']) @@ -277,7 +286,7 @@ module.exports = class Creator extends EventEmitter { if (gitCommitFailed) { warn( - `Skipped git commit due to missing username and email in git config.\n` + + `Skipped git commit due to missing username and email in git config${gpgSign ? ' or failed to sign commit' : ''}.\n` + `You will need to perform the initial commit yourself.\n` ) } From 6b53e77ce3fbb1b736ab194a0d976bb5a991a64d Mon Sep 17 00:00:00 2001 From: Spenser Black <spenserblack01@gmail.com> Date: Wed, 26 Aug 2020 09:32:50 -0400 Subject: [PATCH 2/2] fix(initial commit): avoid GPG sign on test/debug Sets git config `commit.gpgSign` on test or debug to false in order to stop git from attempting to sign commit with a GPG signature that does not belong to test@test.com Addresses #5818 --- packages/@vue/cli/lib/Creator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@vue/cli/lib/Creator.js b/packages/@vue/cli/lib/Creator.js index 4391558eed..4dd321b778 100644 --- a/packages/@vue/cli/lib/Creator.js +++ b/packages/@vue/cli/lib/Creator.js @@ -254,6 +254,7 @@ module.exports = class Creator extends EventEmitter { if (isTestOrDebug) { await run('git', ['config', 'user.name', 'test']) await run('git', ['config', 'user.email', 'test@test.com']) + await run('git', ['config', 'commit.gpgSign', 'false']) } gpgSign = await (async () => { const { stdout: gpgSignConfig } = await run('git', [