Curious if global git config settings are used dur...
# general
r
Curious if global git config settings are used during builds? Working with a go project that has a dependency to a private github repo. Following these go docs for git+https but still seeing an authentication error when packaging with pants.
f
Does the authentication require the presence of environment variables?
r
I don't believe it does just global config setting
f
Is
go
supposed to look in
$HOME/.netrc
for the password?
(going by the docs you linked)
HOME
is not set by default when Pants runs processes in the execution sandbox.
r
I think that's their recommendations on how to configure git nothin go searches for itself. I'll continue debugging this and report here if I find anything
f
At least for
.netrc
, that impacts Go’s ability to find
.netrc
or
.gitconfig
. Specifically because
os.UserHomeDir
looks for the
HOME
environment variable. https://github.com/golang/go/blob/740b0ebb76c4cb6788eb03be683650938a7f5897/src/os/file.go#L500 And the netrc code in
go
uses that call. Haven’t looked at
git
source yet, but I can imagine it is similar. Try setting
--subprocess-environment-env-vars
to include
HOME
to pass it through to the execution sandbox.
r
ahh got it yeah tried setting that setting but still seeing the permission issue
go get on the private repo seems to work tho
f
pants uses
go mod download
to download modules and not
go get
. maybe that makes a difference?
r
hmm I'm not sure both pass as expected but get different results running with pants. I also tried setting .netrc with the subprocess env vars no luck yet. I've used pants with a private pypi for python, this is the first with private github repos and go.
oh wait think it's working now I just had misconfigured the format in the .netrc. This should be fine I can probably get this up in CI too thank you @fast-nail-55400!
for future reference, setting
GIT_SSH_COMMAND
in the environment would have let you override the
ssh
command used by
git
and awesome! glad to hear it is working
r
oh I think this is older thread sorry
f
ah will re-post link there
went looking for the git docs link you had posted and kept in this thread … ugh
r
haaha yeah my apologies for the confusion