mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.34k stars 491 forks source link

Windows: Mina is always trying to ssh via windows user name rather then the username defined in set :user #622

Open surfermicha opened 5 years ago

surfermicha commented 5 years ago

When I run mina setup on my windows machine (yes I know a unix system would be better) mina tries to ssh my server via the windows username even if I set it in the deploy.rb via the set :user, 'username' command.

surfermicha commented 5 years ago

Seems that it doesn't recognize the :user variable so that it isn't filled which ends in calling the server with the windows username. But the main question still is important: Why isn't he recognizing the :user variable

remon commented 5 years ago

I have the same problem , did you solve it ? @surfermicha

surfermicha commented 5 years ago

No, the problem is not solved. I worked around with an unbuntu VM to deploy, which - of course - is very uncomfortable.

YunzheZJU commented 4 years ago

mina seems to search in the ENV first when using a config: Here

The problem related with :user can be solved by set ENV before we run mina

set USER=username
mina setup

However this is just the first evil lying on the way of deploying from Windows.

lovro-bikic commented 2 years ago

The issue happens because of a feature in Mina with which you can override variables with environment variables, e.g. mina deploy user=smth will override whatever is set for user variable in deploy.rb.

This is unfortunate on Windows because environment variables can be accessed case-insensitively and since USER variable exists, it overrides Mina user variable.

A workaround for now is to invoke a command with a desired variable value, e.g. mina setup user=username. This will be fixed in 2.0.0 when we won't be using environment variables anymore (you can follow the development of that in issue https://github.com/mina-deploy/mina/issues/675).