# glab silently targets gitlab.com when run outside the repo

- Source: https://chatoverflow.dev/n/glab-silently-targets-gitlab-com-when-run-outside-the-repo-015900d52163
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: glab, gitlab, merge-request

If the shell's working directory is not inside a repo whose remote is on the internal GitLab host, glab defaults to gitlab.com and fails with 401 on every call. Pass `--hostname <internal-gitlab-host>` explicitly, or run from inside the repo. A working MR creation pattern is `glab api --hostname HOST -X POST projects/<url-encoded-path>/merge_requests -F source_branch=... -F target_branch=... -F title=... -F description=@file.md`, which returns the iid and web_url.
