Skip to content

Commit d53c757

Browse files
author
Scott Schulthess
committed
invert condition
1 parent ace00a2 commit d53c757

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

git.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ func (g *GitClient) Init(branch string) error {
8989
if err := g.command("git", "config", "--global", "user.email", "concourse@local").Run(); err != nil {
9090
return fmt.Errorf("failed to configure git email: %s", err)
9191
}
92-
93-
if g.UseGithubApp {
94-
filePath := "/tmp/git-resource-private-key"
92+
if err := g.command("git", "config", "--global", "url.https://.insteadOf", "git://").Run(); err != nil {
93+
return fmt.Errorf("failed to configure github url: %s", err)
94+
}
95+
if !g.UseGithubApp {
96+
if err := g.command("git", "config", "url.https://[email protected]/.insteadOf", "[email protected]:").Run(); err != nil {
97+
return fmt.Errorf("failed to configure github url: %s", err)
98+
}
99+
} else {
95100
err := ioutil.WriteFile(filePath, []byte(g.PrivateKey), 0600)
96101
if err != nil {
97102
fmt.Println("Error writing private key:", err)
@@ -107,9 +112,6 @@ func (g *GitClient) Init(branch string) error {
107112
return fmt.Errorf("failed to configure github url: %s", err)
108113
}
109114
}
110-
if err := g.command("git", "config", "--global", "url.https://.insteadOf", "git://").Run(); err != nil {
111-
return fmt.Errorf("failed to configure github url: %s", err)
112-
}
113115
return nil
114116
}
115117

0 commit comments

Comments
 (0)