Is there some way to use ssh-based authentication when accessing the GitHub API through the command line (via, e.g., curl, etc.?).
FWIW, I tried many variations of the following (varying the way I specified my public ssh key file) but in every case I was still prompted for my password:
% curl --pubkey ~/.ssh/id_rsa.pub --user yrstruly https://api.github.com/user/repos
Git uses SSH to establish a secure connection through which it can execute commands. You're passing it in your ssh username, git , and the host to connect to, github.com . So far this is normal SSH. You also pass it the path to look for your Git repository, MY_GIT_USERNAME/PROJECT.
If you are using ssh, then you would never logon as 'yrstruly
'. You would always connect as 'git'.
Your public key would be enough for GitHub to recognize you as 'yrstruly
'.
And since you are using an https address, and not an ssh one, that --pubkey
option is likely to be ignored.
A valid ssh address would be: ssh://[email protected]
, and I don't think Github proposes that kind of access for its api.
The curl --user
option would be necessary for https address only, as in "Having trouble downloading Git archive tarballs from Private Repo":
curl -sL --user "${username}:${password}" https://github.com...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With