Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the name and person/org of the current repo for use in .gitconfig?

Basically what I'm trying to do is have a handy tool where I can say:

git open

This will just open up the current github repository in your browser. If I can get the name I could just use an alias with https://github.com/{user or org}/{repo name}.

like image 746
Alex Cory Avatar asked Jan 21 '26 19:01

Alex Cory


1 Answers

try this bash function

For Linux:

function git-open-url(){
  xdg-open `git config --get remote.origin.url`
}

For Mac:

function git-open-url(){
  open `git config --get remote.origin.url`
}
like image 54
Jiri Kremser Avatar answered Jan 23 '26 20:01

Jiri Kremser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!