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

Read authentication credentials from environment #46

Open
kewisch opened this issue May 25, 2015 · 1 comment
Open

Read authentication credentials from environment #46

kewisch opened this issue May 25, 2015 · 1 comment

Comments

@kewisch
Copy link

kewisch commented May 25, 2015

I'd like to use this in an environment with travis. There are two common options authentication there, one being a github personal access token, the other to use a project specific deployment ssh key. Both are read via the environment, the ssh key is usually base64 encoded.

I'm not totally sure ssh key via env works, I've read reports that the travis environment variables are too short for a full ssh key, but from a simple test it seemed to work for me.

What do you think about adding support for this to grunt-gh-pages? I'd imagine something like this in the config:

// ssh key from environment:
"gh-pages": {
  repo: "git@github.com:tschaub/grunt-gh-pages.git"
  sshEnv: "GITHUB_KEY"
}
// token from env
"gh-pages": {
  repo: "https://github.com/tschaub/grunt-gh-pages.git"
  tokenEnv: "GITHUB_TOKEN"
}

In the first case, it would read that key, base64-decode it, write it to a temporary file, call ssh-add on it. In the second case, it would parse the repo url and add the token as a username, e.g. https://tokenFromEnvHere@github.com/tschaub/grunt-gh-pages.git. If you prefer, we could use a single config key envAuth and then detect if its a https repo url or ssh url.

If you are up for this, I could probably find some time to send a pull request. On the other hand, this can of course be done with a custom task that runs beforehand and sets the right config values.

@Draym
Copy link

Draym commented Jul 5, 2021

any thoughts on that?

I got the same issue when I try to deploy within a Github action

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

2 participants