Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Tilde expansion fails for ssh key value #18

mehulved opened this Issue · 3 comments

3 participants


I tried using tilde for my ssh key path. But that fails to find the key. I ensured that the path was correct. But, when I replaced the tilde with user homedir path, it worked fine.
Is the tilde expansion disabled or does it expand to root path? I did execute the script as own user. And there's the ssh key in that user's path.


What doesn't work

$ deploy development setup
Warning: Identity file ~/.ssh/ not accessible: No such file or directory.
$ cat deploy.conf 
key ~/.ssh/
user mehul

What works

$ cat deploy.conf 
key /home/mehul/.ssh/
user mehul
$ deploy development setup
Enter passphrase for key '/home/mehul/.ssh/': 

I see this issue over and over again, when script ssh commands. I'd love to hear an explanation why. Simple avoidance is to replace '~' with "$HOME" when parsing configuration.


This is how bash works. As soon as a tilde has been quoted, i.e., '~', it will not be expanded. Usually one bypasses this by using $HOME instead.

One can expand tilde by using eval, but usually one want to avoid this. See for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.