Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can push to links without a password prompt since it's using my ssh-agent. However when I push to it always asks for username and password.

The issue can somewhat be alleviated by using password caching, but I'd rather not use that.

This mainly pops up when using gists because they only show an https link (e.g. I don't want to modify the URL of every gist I clone to use the version.

How do I set it up so that git uses my ssh-agent when pushing to an https address?

Relevant URL: Why does GitHub recommend HTTPS over SSH?

share|improve this question

I've resorted to writing a git wrapper function:

function gc {
    if [[ ${1} =~ "" ]] && [[ ${1} =~ "https" ]]; then
        git clone ${${1/https:\/\//git@}/\//:} ${@:2}
        git clone ${@}
share|improve this answer

Set it in your GitHub account.

According to your own link it seems unsupported, I guess you could write a small function in .bashrc to rewrite the remotes in git style.

share|improve this answer
I already have the SSH keys added to my account. I'm asking how to get it working with https links and not just links. – wting Jan 19 '13 at 17:22
Why not just use the Git link? Gists might not support R+W access... – Tom Wijsman Jan 19 '13 at 17:25
Gists do support r+w access, but only the https link is shown. I would rather not have to modify the clone link every time I clone a gist. – wting Jan 19 '13 at 17:27
@WilliamTing: Oh right, just checked and works here. I believe this to be a local problem and thus not related to GitHub, please double check your configuration and follow the relevant steps again... Is there a firewall in the way? – Tom Wijsman Jan 19 '13 at 17:29
You can push to https using ssh-agent? There's no firewall in the way. – wting Jan 19 '13 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .