Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include documentation around adding a private Github repo to Go #73

Open
anishvenkat opened this issue Mar 7, 2017 · 2 comments
Open

Comments

@anishvenkat
Copy link
Contributor

This is a placeholder for the documentation update to add notes on how to add private Github repositories to Go in the FAQ section.

@oxinabox
Copy link
Contributor

oxinabox commented Jan 9, 2018

For anyone finding this issue before it is properly solved with docs,
the following threads have some details:

@ctrabold
Copy link

ctrabold commented Feb 9, 2018

@oxinabox yes, hardcoding the username and password into the material URL works.

Yet I prefer to store sensitive data like this outside the GoCD server. Here's how I've solved it by using .git-credentials:

CONFIG_FOLDER=/var/lib/go-server/config
# also do it on the agents (assuming Docker file structure here)
# CONFIG_FOLDER=/go-agent/config

if [[ -n $GOCD_GITHUB_USERNAME || -n $GOCD_GITHUB_ACCESS_TOKEN ]]; then
  git config --global credential.helper "store --file ${CONFIG_FOLDER}/.git-credentials"
  cat <<EOF > ${CONFIG_FOLDER}/.git-credentials
https://${GOCD_GITHUB_USERNAME}:${GOCD_GITHUB_ACCESS_TOKEN}@github.com
EOF
fi

The .git-credentials file is created either during service startup (e.g. Docker / K8 / OpenShift) with the variables provided or via config management or by hand.

That being said I'd like to hear what the official recommendation in the FAQ for this is.

I think support for secure variables in material URLs would make it much easier for users to configure access for private repos.

Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants