mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
Add http protocol for Gitlab custom host (#60)
* Add http protocol for Gitlab custom host * default to https * Revert "default to https" This reverts commitb25190b5d1. * Revert "Merge branch 'master' into http" This reverts commit18573f8b29, reversing changes made to88a9e254ae. * Revert "Revert "Merge branch 'master' into http"" This reverts commitfa0e6d1f21. * Revert "Revert "default to https"" This reverts commitd754476010.
This commit is contained in:
parent
bbc50d7018
commit
4e3aa0ad51
|
|
@ -113,6 +113,12 @@ git config [--global] gitopen.gitlab.ssh.domain [value]
|
|||
git config [--global] gitopen.gitlab.ssh.port [value]
|
||||
```
|
||||
|
||||
If your Gitlab custom hosted is serving `http` you can also specify this:
|
||||
```sh
|
||||
# use --global to set across all repos, instead of just the local one
|
||||
git config [--global] gitopen.gitlab.protocol http
|
||||
```
|
||||
|
||||
## Related projects / alternatives
|
||||
|
||||
See [hub](https://github.com/github/hub) for complete GitHub opening support.
|
||||
|
|
|
|||
12
git-open
12
git-open
|
|
@ -95,14 +95,20 @@ else
|
|||
gitlab_ssh_domain=$(git config --get gitopen.gitlab.ssh.domain)
|
||||
gitlab_ssh_domain=${gitlab_ssh_domain:-$gitlab_domain}
|
||||
gitlab_ssh_port=$(git config --get gitopen.gitlab.ssh.port)
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
|
||||
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
|
||||
if [ -z "$gitlab_protocol" ]; then
|
||||
gitlab_protocol=https
|
||||
fi
|
||||
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
|
||||
|
||||
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}\:/https://${gitlab_domain}/}
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
|
||||
|
||||
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
|
||||
giturl=${giturl/#ssh\:\/\//https://}
|
||||
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
|
||||
|
||||
# remove git@ from the domain
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}
|
||||
|
|
|
|||
Loading…
Reference in a new issue