Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can push to git@github.com:wting/repo.git links without a password prompt since it's using my ssh-agent. However when I push to https://github.com/wting/repo.git 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. https://gist.github.com/123.git). I don't want to modify the URL of every gist I clone to use the git@gist.github.com:123.git 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
add comment

2 Answers 2

I've resorted to writing a git wrapper function:

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

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 git@github.com 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
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.