magithub icon indicating copy to clipboard operation
magithub copied to clipboard

Support URL aliases from .gitconfig

Open bqv opened this issue 7 years ago • 6 comments

My ~/.gitconfig is as follows:

[user]
    name = Tony Olagbaiye                                                                                                                                                                                                          
    email = [email protected]
[push]
    default = simple                                                                                                                                                                                                               
[credential]
    helper = cache
                                                                                                                                                                                                                                   [url "[email protected]:"]
    insteadOf = "gh:"
    pushInsteadOf = "github:"                                                                                                                                                                                                      
    pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
    insteadOf = "github:"                                                                                                                                                                                                          
[url "[email protected]:"]
    insteadOf = "gst:"
    pushInsteadOf = "gist:"                                                                                                                                                                                                        
    pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
    insteadOf = "gist:"                                                                                                                                                                                                            
[url "[email protected]:"]
    insteadOf = "heroku:"
[github]                                                                                                                                                                                                                           
    user = bqv

This means I can clone and push to repositories with remote urls that look like gh:vermiculus/magithub.

It would be great if magithub could detect these and treat them as github repositories instead of me having to manually change all my remotes.

bqv avatar May 08 '18 15:05 bqv

Is there a way to ask git to resolve a URL with these rules?

vermiculus avatar May 08 '18 15:05 vermiculus

Looks like this can be done with git ls-remote --get-url

vermiculus avatar May 08 '18 15:05 vermiculus

git remote seems more appropriate here, git ls-remote is about getting up-to-date data from the remote in most case. --get-url is one of the other cases.

tarsius avatar May 17 '18 17:05 tarsius

Would this make sense as a patch to magit?

vermiculus avatar Aug 27 '18 20:08 vermiculus

A patch to do what exactly?

tarsius avatar Aug 28 '18 08:08 tarsius

Maybe if there's a function that gets a URL from a remote (on mobile right now or maybe of have a code reference). If that's so, then it may be made to handle this.

Sorry I can't provide more details right now :-(

vermiculus avatar Aug 28 '18 14:08 vermiculus