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'm using git on a Mac, and I'd like to know if there's a command to open the remote repository (origin) in a browser from the terminal.

share|improve this question
    
"Open" certainly isn't a git technical term... –  Ignacio Vazquez-Abrams Feb 6 '13 at 7:54
    
Right. I added the "in a browser" to clarify –  chrisf Feb 6 '13 at 8:00
    
For example, the equivalent with Heroku would be heroku open –  chrisf Feb 6 '13 at 8:03
    
The remote repository is the URL with .git, e.g. git@github.com:slhck/foo.git, so how'd you map this to whatever HTML representation there is? Are you talking about a special repository like GitHub only, or… ? –  slhck Feb 6 '13 at 8:14
1  
At least with Github, the URLs that come up when I run git remote -v seem to be accessible when plugged into a browser. I guess this wouldn't apply in all situations, though. –  chrisf Feb 6 '13 at 8:37

2 Answers 2

up vote 0 down vote accepted

You can"t view the remote repository in a browser as the browser requires a webserver. What you can do though is clone the remote repository (if you haven't done so already) and then run the git instaweb command in the directory of the local repository, which will let you browse the history, branches, commits, diffs...

share|improve this answer
    
I like that. Not quite what I was talking about, but perhaps this is a preferable alternative. –  chrisf Feb 8 '13 at 14:19

It's kind of ugly, and will only work in a few cases, but I came up with a way that works for me.

$ git remote -v | awk '/origin.*push/ {print $2}' | xargs open

I then assigned that to the alias gitrm. I'm not sure if open works on anything besides OSX, though.

In the end I realized that not every remote repository has a friendly web-based frontend, so it wouldn't really make sense for git to provide a command to open them.

share|improve this answer

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.