I’ve searched and I’ve searched, and I’ve tried so many different permutations/options that my head is spinning and I just can’t get this to work. All I’m trying to do is push back changes to GitHub if
However, I keep getting fatal: could not read Username for 'https://github.com': terminal prompts disabled in my logs. I’ve read Fatal: could not read Username for and tried all the steps there but nothing. What’s weird is that it works completely fine on a private repo. It’s only public repos (which are mine) that it doesn’t work.
I’ve also tried turning on DRONE_GIT_ALWAYS_AUTH to true, but still nada.
EDIT: Nevermind, apparently I hadn’t actually set the always auth variable/not restarted.
If you want to push to a repository, the recommended approach to providing credentials would be to use secrets to inject the credentials into your pipeline step (see an example here). We also provide a plugin that can be used to push code (see an example here).
I do not recommend using DRONE_GIT_ALWAYS_AUTH for this purpose. The DRONE_GIT_ALWAYS_AUTH flag is meant for teams that are using GitHub Enterprise behind the firewall with private mode enabled, which requires authentication to clone public repositories. If you enable this flag for GitHub cloud, a bad actor could send your public repository a pull request that intercepts your git credentials.
I use that plugin without issue (this is our real-world pipeline configuration and this is a successful build) however, if you are having issues with the plugin you should consult the plugin author or consider sending a pull request to help them patch.
Also keep in mind that Drone clones your repository using git+https. The reason you see an error (in the logs you posted above) is because the remote is git+https as opposed to git+ssh, and the ssh key cannot be used to authenticate a git+https remote. So if you want to push to your repository using an ssh key, you need to change the git remote to use the ssh repository url (e.g. git remote add upstream [email protected]:foo/bar.git; git push upstream master)
In summary, there has to be an easier way to do this. Seems like a pretty basic thing to do.
The easiest option is to use the git push plugin (which we are using here). I understand you are having issues with the plugin but this is not something I can help you troubleshoot further. I recommend reaching out to the author directory or inspecting the source code (in the spirit of open source) to see if you can help the author improve.
I was getting an invalid key format error which i’ve resolved […]