From 5b226525b332718d26fabcfbd1830cdc32336398 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Wed, 20 Apr 2022 21:37:43 -0400 Subject: Add set-safe-directory input to allow customers to take control. (#770) * Add set-safe-directory input to allow customers to take control. --- src/git-auth-helper.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/git-auth-helper.ts') diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index 385142a..8a1c7c3 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -19,7 +19,7 @@ export interface IGitAuthHelper { configureAuth(): Promise configureGlobalAuth(): Promise configureSubmoduleAuth(): Promise - configureTempGlobalConfig(repositoryPath?: string): Promise + configureTempGlobalConfig(): Promise removeAuth(): Promise removeGlobalConfig(): Promise } @@ -81,7 +81,7 @@ class GitAuthHelper { await this.configureToken() } - async configureTempGlobalConfig(repositoryPath?: string): Promise { + async configureTempGlobalConfig(): Promise { // Already setup global config if (this.temporaryHomePath?.length > 0) { return path.join(this.temporaryHomePath, '.gitconfig') @@ -121,21 +121,6 @@ class GitAuthHelper { ) this.git.setEnvironmentVariable('HOME', this.temporaryHomePath) - // Setup the workspace as a safe directory, so if we pass this into a container job with a different user it doesn't fail - // Otherwise all git commands we run in a container fail - core.info( - `Adding working directory to the temporary git global config as a safe directory` - ) - await this.git - .config( - 'safe.directory', - repositoryPath ?? this.settings.repositoryPath, - true, - true - ) - .catch(error => { - core.info(`Failed to initialize safe directory with error: ${error}`) - }) return newGitConfigPath } -- cgit v1.2.3