C
Coder.com•2mo ago
Mikel

Issue with Cloning a Specific Branch from a Private GitLab Repo Using SSH in Envbuilder

Hi everyone, I'm encountering an issue when using Envbuilder with SSH for cloning private repositories. Here's what I've noticed: When I work with a public repository and use HTTPS, everything works fine. I can clone the main branch and even specify another branch, as described in the documentation, like this:
ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer/#refs/heads/my-feature-branch
ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer/#refs/heads/my-feature-branch
However, when I switch to a private repository that requires SSH authentication, I can successfully clone the main branch, but I'm unable to specify a different branch (e.g., sample-branch). Here's the Git URL format I'm using for the private repo:
[email protected]:your-group/your-repo.git/#refs/heads/sample-branch
[email protected]:your-group/your-repo.git/#refs/heads/sample-branch
The error I get in the logs when trying to clone with a specified branch is:
Failed to clone repository: clone "[email protected]:your-group/your-repo.git/#refs/heads/sample-branch": unknown error: remote: ERROR: The namespace you were looking for could not be found.
Failed to clone repository: clone "[email protected]:your-group/your-repo.git/#refs/heads/sample-branch": unknown error: remote: ERROR: The namespace you were looking for could not be found.
Am I making any syntax errors, or has anyone else faced a similar issue when using SSH and specifying a branch? Any advice or guidance on how to resolve this would be greatly appreciated. Thanks in advance for your help!
Solution:
I have opened an issue so our engineers can take a look at implenting it -> https://github.com/coder/envbuilder/issues/456 in the meantime I'd suggest you'd look into using External Auth instead of using HTTP deploy tokens...
Jump to solution
8 Replies
Codercord
Codercord•2mo ago
<#1354136229498585158>
Category
Bug report
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys•5w ago
hey @Mikel try getting rid of the trailing slash at the end of your URL ah nevermind, didn't read the full thing yeah I don't think it's possible with SSH, i'll try/ask
Mikel
MikelOP•5w ago
Hey @Phorcys thanks for your answer, in the meantime I was able to clone the private repo with deploy tokens using https but it would be nice to know more about the SSH limitations 🙂
Phorcys
Phorcys•3w ago
I have asked internally and it seems we didn't factor that in when implementing it
Solution
Phorcys
Phorcys•3w ago
I have opened an issue so our engineers can take a look at implenting it -> https://github.com/coder/envbuilder/issues/456 in the meantime I'd suggest you'd look into using External Auth instead of using HTTP deploy tokens
Mikel
MikelOP•3w ago
Oh great, we will adapt our use case to use External Auth then, thanks for your help! 🙂
Phorcys
Phorcys•2w ago
sounds good!
Codercord
Codercord•2w ago
@Phorcys closed the thread.

Did you find this page helpful?