envbuilder clone a private git repository?

- I've added my Coder SSH public key to github. - I'm using a template based on the aws-devcontainer template. - I set repo_url to [email protected]:foo/bar Envbuilder fails to authenticate:
envbuilder v1.1.0+a3a6a83 - Build development environments from repositories in a container
#1: 📦 Cloning [email protected]:foo/bar to /workspaces/bar...
#1: 🔑 Using SSH authentication!
#1: 🔑 No SSH key found, falling back to agent!
#1: ❌ Failed to connect to SSH agent: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
#1: Parsed Git URL as "ssh://[email protected]/foo/bar"
Failed to clone repository: clone "[email protected]:foo/bar": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
Falling back to the default image...
envbuilder v1.1.0+a3a6a83 - Build development environments from repositories in a container
#1: 📦 Cloning [email protected]:foo/bar to /workspaces/bar...
#1: 🔑 Using SSH authentication!
#1: 🔑 No SSH key found, falling back to agent!
#1: ❌ Failed to connect to SSH agent: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
#1: Parsed Git URL as "ssh://[email protected]/foo/bar"
Failed to clone repository: clone "[email protected]:foo/bar": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
Falling back to the default image...
After the fall back image starts, I can git clone and the agent ssh successfully authenticates. I'm guessing envbuilder is trying to clone the repo before the agent is pulled by the ENVBUILDER_INIT_SCRIPT. I think the logs corroborate that. Is there a way to get the clone to work the first startup?
Solution:
@David envbuilder is a bit specific and requires extra work to get the SSH key inside the workspace, you'll have to set either ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH or ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64 from data.coder_workspace_owner.me.ssh_private_key's contents see https://github.com/coder/envbuilder/issues/333 for more context I'd also suggest you'd look into using External Auth, which could make it easier for you...
Jump to solution
3 Replies
Codercord
Codercord2w ago
<#1359681136967684137>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Solution
Phorcys
Phorcys2w ago
@David envbuilder is a bit specific and requires extra work to get the SSH key inside the workspace, you'll have to set either ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH or ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64 from data.coder_workspace_owner.me.ssh_private_key's contents see https://github.com/coder/envbuilder/issues/333 for more context I'd also suggest you'd look into using External Auth, which could make it easier for you
Phorcys
Phorcys2w ago
that said, i think we should be able to set the ENVBUILDER_GIT_SSH_* stuff by default in our example templates to avoid this

Did you find this page helpful?