#importing private github module

29 messages · Page 1 of 1 (latest)

dire hare
#

I made a golang library that i re-utilize commonly between my company projects, and the repository is of course private, ive been trying to import it from github directly like you often do for 3rd party libraries, but this doesnt work as i need git authentication, afaik go package manager uses git under the hood but even using GOPRIVATE env var and replacing gitconfig url with a x-auth-basic didnt work, any precise guide on how to effectively use private repositories as modules on both windows and linux?

#

importing private github module

plush nimbus
dire hare
#

ive added a new ssh keypair and added it to ssh agent but when cloning i get permission denied

#

i created the ssh key in my acc and the private repo is of my organization, maybe has something to do with that

dire hare
warm karma
plush nimbus
dire hare
#

i get this error

#

but i did add the ssh keys

plush nimbus
#

Did you try to clone the repository via ssh? Seems like something is wrong with your ssh config

dire hare
#

and it clones just fine

viscid nimbus
dire hare
#

because otherwise it doesnt work ive already tried

viscid nimbus
dire hare
#

wym in my terminal, thats not a command

#

its an env var... ?

viscid nimbus
#

yes i am aware , sorry this might be confusing but i developed the habit of setting the env variable like this in the terminal coz i have multiple private repos .
so i change the GOPRIVATE variable each time with different repo
long story short all you need to do is to type this in the terminal

GOPRIVATE=github.com/githubUsername/reponName go get github.com/githubUsername/reponName

go will see the GOPRIVATE as env variable and then it will import the private repo to your app.

assuming you're already configured git with the credentials needed to access your private repo

dire hare
viscid nimbus