Nodejs packages.json, git@github URLs, ssh password

Hi,

I’m trying to build & snap a nodejs project that uses a packages.json file with yarn.

The packages.json file has URLs to github.com. They currently take the form git+https://github.com/user/ETC.

Since I use ssh for git access, I cannot use git+https:// URLS. I’ve changed them to git@github.com:user/ETC, but this does not work, I think because there is no opportunity during the snapcraft build for me to enter the ssh password.

Is there a method to get around this?

Thanks.

This can be handled by generating an access token on github, then:

`echo https://<YOUR_GITHUB_USERNAME>:<GITHUB_ACCESS_TOKEN>@github.com > ~/.git-credentials`
`git config --global credential.helper store`

Is there a specific reason why HTTPs URLs cannot be used? Are these repositories private?

Snapcraft builds ordinarily have no problems accessing HTTPs GitHub URLs.

It turned out to be auto providing the needed creds to git (without user prompting) during the snapcraft build, which the git credential stuff solved.

1 Like

OK, cool. @degville, do you think it could be helpful to document something about accessing private github repos?

Thanks for the ping (and thanks for the details @kyleN). I’ll test it out and add the details to the docs.

1 Like