You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: --ssh-identity Flag in dstack apply is Ignored #2317
changed the title [-][Bug]: --ssh-identity` Flag in `dstack apply` is Ignored[/-][+][Bug]: `--ssh-identity` Flag in `dstack apply` is Ignored[/+]on Feb 18, 2025
@movchan74, --ssh-identity is part of the repo options.
Other repo options
$ dstack apply --help
...
Repo Options:
-P, --repo REPO The repo to use for the run. Can be a local path or a Git repo URL.
--repo-branch REPO_BRANCH
The repo branch to use for the run
--repo-hash REPO_HASH
The hash of the repo commit to use for the run
--no-repo Do not use any repo for the run
-t, --token OAUTH_TOKEN
An authentication token to access a private Git repo
--git-identity SSH_PRIVATE_KEY
The private SSH key path to access a private Git repo
--ssh-identity SSH_PRIVATE_KEY
The private SSH key path for SSH tunneling
--local Do not use Git
Repo options are only respected if --repo is passed. They are a shorthand for initializing the repo without calling dstack init explicitly.
But I agree that the behavior described in the issue is counterintuitive. Here is what we could do to improve it:
Prevent repo options from being ignored. Either:
show an error if any repo options are passed without --repo;
or assume --repo . if any repo options are passed.
Consider making --ssh-identity a run option rather than a repo option, so that it is possible to override the key for a run without associating that key with the repo.
@jvstme, thanks for the explanation. It is counterintuitive that the --ssh-identity option is tied to repo settings. The help text clearly indicates that it's for SSH tunneling, so having it only work when a repo is specified feels off.
As you mentioned, making --ssh-identity a run option would allow us to override the SSH key for a run without binding it to a repo. I fully support moving it to run options or, at the very least, updating the documentation to clarify its intended behavior.
Another point why it should be a run option. dstack attach also has --ssh-identity option, but it is definitely a run option.
Activity
[-][Bug]: --ssh-identity` Flag in `dstack apply` is Ignored[/-][+][Bug]: `--ssh-identity` Flag in `dstack apply` is Ignored[/+]jvstme commentedon Mar 4, 2025
@movchan74,
--ssh-identityis part of the repo options.Other repo options
Repo options are only respected if
--repois passed. They are a shorthand for initializing the repo without callingdstack initexplicitly.So to set the SSH key, you can do this:
$ dstack apply -f app.dstack.yaml --ssh-identity ./id_rsa --repo .Or this, which is equivalent:
jvstme commentedon Mar 4, 2025
But I agree that the behavior described in the issue is counterintuitive. Here is what we could do to improve it:
--repo;--repo .if any repo options are passed.--ssh-identitya run option rather than a repo option, so that it is possible to override the key for a run without associating that key with the repo.movchan74 commentedon Mar 5, 2025
@jvstme, thanks for the explanation. It is counterintuitive that the --ssh-identity option is tied to repo settings. The help text clearly indicates that it's for SSH tunneling, so having it only work when a repo is specified feels off.
As you mentioned, making --ssh-identity a run option would allow us to override the SSH key for a run without binding it to a repo. I fully support moving it to run options or, at the very least, updating the documentation to clarify its intended behavior.
Another point why it should be a run option.
dstack attachalso has--ssh-identityoption, but it is definitely a run option.peterschmidt85 commentedon Apr 3, 2025
@jvstme Do we have an update on it?
jvstme commentedon Apr 3, 2025
@peterschmidt85, no. There is an explanation of how to achieve the desired behavior. The proposed UX improvements are in the backlog as part of this issue
github-actions commentedon Jun 9, 2025
This issue is stale because it has been open for 30 days with no activity.
un-def commentedon Sep 3, 2025
Fixed via #3023 in 0.19.26