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
This commit is contained in:
parent
70e7399140
commit
88a9e254ae
|
|
@ -105,6 +105,12 @@ To configure GitLab support you need to set `gitopen.gitlab.domain`:
|
|||
git config [--global] gitopen.gitlab.domain [yourdomain.here]
|
||||
```
|
||||
|
||||
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.
|
||||
|
|
|
|||
8
git-open
8
git-open
|
|
@ -93,14 +93,18 @@ else
|
|||
# custom GitLab
|
||||
gitlab_domain=$(git config --get gitopen.gitlab.domain)
|
||||
gitlab_port=$(git config --get gitopen.gitlab.port)
|
||||
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
|
||||
if [ -z "$gitlab_protocol" ]; then
|
||||
gitlab_protocol=http
|
||||
fi
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
if grep -q "$gitlab_domain" <<<$giturl; then
|
||||
|
||||
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
|
||||
giturl=${giturl/git\@${gitlab_domain}\:/https://${gitlab_domain}/}
|
||||
giturl=${giturl/git\@${gitlab_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_domain}/${gitlab_domain}/}
|
||||
|
|
|
|||
Loading…
Reference in a new issue