https://pantsbuild.org/ logo
#general
Title
# general
r

rapid-bird-79300

05/19/2022, 4:20 AM
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

fast-nail-55400

05/19/2022, 4:24 AM
Does the authentication require the presence of environment variables?
r

rapid-bird-79300

05/19/2022, 4:25 AM
I don't believe it does just global config setting
f

fast-nail-55400

05/19/2022, 4:28 AM
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

rapid-bird-79300

05/19/2022, 4:33 AM
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

fast-nail-55400

05/19/2022, 4:34 AM
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

rapid-bird-79300

05/19/2022, 4:41 AM
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

fast-nail-55400

05/19/2022, 5:27 AM
pants uses
go mod download
to download modules and not
go get
. maybe that makes a difference?
r

rapid-bird-79300

05/19/2022, 6:13 AM
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

rapid-bird-79300

05/19/2022, 7:52 PM
oh I think this is older thread sorry
f

fast-nail-55400

05/19/2022, 7:53 PM
ah will re-post link there
went looking for the git docs link you had posted and kept in this thread … ugh
r

rapid-bird-79300

05/19/2022, 7:54 PM
haaha yeah my apologies for the confusion
5 Views