Skip to content

Commit 4e3aa0a

Browse files
MartinDelillepaulirish
authored andcommitted
Add http protocol for Gitlab custom host (paulirish#60)
* Add http protocol for Gitlab custom host * default to https * Revert "default to https" This reverts commit b25190b. * Revert "Merge branch 'master' into http" This reverts commit 18573f8, reversing changes made to 88a9e25. * Revert "Revert "Merge branch 'master' into http"" This reverts commit fa0e6d1. * Revert "Revert "default to https"" This reverts commit d754476.
1 parent bbc50d7 commit 4e3aa0a

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ git config [--global] gitopen.gitlab.ssh.domain [value]
113113
git config [--global] gitopen.gitlab.ssh.port [value]
114114
```
115115
116+
If your Gitlab custom hosted is serving `http` you can also specify this:
117+
```sh
118+
# use --global to set across all repos, instead of just the local one
119+
git config [--global] gitopen.gitlab.protocol http
120+
```
121+
116122
## Related projects / alternatives
117123
118124
See [hub](https://github.com/github/hub) for complete GitHub opening support.

git-open

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,20 @@ else
9595
gitlab_ssh_domain=$(git config --get gitopen.gitlab.ssh.domain)
9696
gitlab_ssh_domain=${gitlab_ssh_domain:-$gitlab_domain}
9797
gitlab_ssh_port=$(git config --get gitopen.gitlab.ssh.port)
98-
if [ -n "$gitlab_domain" ]; then
98+
99+
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
100+
if [ -z "$gitlab_protocol" ]; then
101+
gitlab_protocol=https
102+
fi
103+
104+
if [ -n "$gitlab_domain" ]; then
99105
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
100106

101107
# Handle GitLab's default SSH notation (like [email protected]:user/repo)
102-
giturl=${giturl/git\@${gitlab_ssh_domain}\:/https://${gitlab_domain}/}
108+
giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
103109

104110
# handle SSH protocol (links like ssh://[email protected]/user/repo)
105-
giturl=${giturl/#ssh\:\/\//https://}
111+
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
106112

107113
# remove git@ from the domain
108114
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}

0 commit comments

Comments
 (0)