feat: add SSH commit signing to git identities
Configure commit signing per Git identity Apply SSH signing settings automatically Support signing in web and VS Code
This commit is contained in:
@@ -68,6 +68,8 @@ export function createProfile(profileData) {
|
||||
userEmail: profileData.userEmail,
|
||||
authType: profileData.authType || 'ssh',
|
||||
sshKey: profileData.sshKey || null,
|
||||
signCommits: profileData.signCommits,
|
||||
signingKey: profileData.signingKey || null,
|
||||
host: profileData.host || null,
|
||||
color: profileData.color || 'keyword',
|
||||
icon: profileData.icon || 'branch'
|
||||
|
||||
@@ -1913,6 +1913,12 @@ export async function setLocalIdentity(directory, profile) {
|
||||
await git.raw(['config', '--local', '--unset', 'core.sshCommand']).catch(() => {});
|
||||
}
|
||||
|
||||
if (profile.signCommits === true && typeof profile.signingKey === 'string' && profile.signingKey.trim()) {
|
||||
await git.addConfig('gpg.format', 'ssh', false, 'local');
|
||||
await git.addConfig('user.signingkey', profile.signingKey.trim(), false, 'local');
|
||||
await git.addConfig('commit.gpgsign', 'true', false, 'local');
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Failed to set Git identity:', error);
|
||||
|
||||
Reference in New Issue
Block a user