[gitsync] Small fixes to make it work in K8s and more logging

Bug: skia:8665
Change-Id: Ieeffa2096b21bbf65435932e72ab46a75ec743e0
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/200485
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Stephan Altmueller <stephana@google.com>
diff --git a/gitsync/cmd/gitsync/main.go b/gitsync/cmd/gitsync/main.go
index b9ccf93..c4c48b5 100644
--- a/gitsync/cmd/gitsync/main.go
+++ b/gitsync/cmd/gitsync/main.go
@@ -5,7 +5,6 @@
 	"flag"
 	"log"
 	"net/http"
-	"os/user"
 	"path/filepath"
 	"strings"
 	"time"
@@ -59,13 +58,9 @@
 
 	// Set up Git authentication if a service account email was set.
 	if !*local {
-		user, err := user.Current()
-		if err != nil {
-			sklog.Fatal(err)
-		}
-
-		// Use the gitcookie created by gitauth package if .gitcookies does not already exist.
-		gitcookiesPath := filepath.Join(user.HomeDir, ".gitcookies")
+		// Use the gitcookie created by the gitauth package.
+		gitcookiesPath := "/tmp/gitcookies"
+		sklog.Infof("Writing gitcookies to %s", gitcookiesPath)
 		if _, err := gitauth.New(ts, gitcookiesPath, true, ""); err != nil {
 			sklog.Fatalf("Failed to create git cookie updater: %s", err)
 		}
@@ -112,5 +107,6 @@
 
 	// Set up the http handler to indicate ready-ness and start serving.
 	http.HandleFunc("/healthz", httputils.ReadyHandleFunc)
+	sklog.Infof("Listening on port: %s", *httpPort)
 	log.Fatal(http.ListenAndServe(*httpPort, nil))
 }