Skip to content

Commit 88a9e25

Browse files
committed
Add http protocol for Gitlab custom host
1 parent 70e7399 commit 88a9e25

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ To configure GitLab support you need to set `gitopen.gitlab.domain`:
105105
git config [--global] gitopen.gitlab.domain [yourdomain.here]
106106
```
107107
108+
If your Gitlab custom hosted is serving `http` you can also specify this:
109+
```sh
110+
# use --global to set across all repos, instead of just the local one
111+
git config [--global] gitopen.gitlab.protocol http
112+
```
113+
108114
## Related projects / alternatives
109115
110116
See [hub](https://github.com/github/hub) for complete GitHub opening support.

git-open

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,18 @@ else
9393
# custom GitLab
9494
gitlab_domain=$(git config --get gitopen.gitlab.domain)
9595
gitlab_port=$(git config --get gitopen.gitlab.port)
96+
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
97+
if [ -z "$gitlab_protocol" ]; then
98+
gitlab_protocol=http
99+
fi
96100
if [ -n "$gitlab_domain" ]; then
97101
if grep -q "$gitlab_domain" <<<$giturl; then
98102

99103
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
100-
giturl=${giturl/git\@${gitlab_domain}\:/https://${gitlab_domain}/}
104+
giturl=${giturl/git\@${gitlab_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
101105

102106
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
103-
giturl=${giturl/#ssh\:\/\//https://}
107+
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
104108

105109
# remove git@ from the domain
106110
giturl=${giturl/git\@${gitlab_domain}/${gitlab_domain}/}

0 commit comments

Comments
 (0)