Sync script with Lima

Hey ya’ll… I found this:

https://discourse.roots.io/t/tweaks-for-sync-script-with-trellis-and-lima/26715/2

And attempting to connect to Lima without any luck.

✅  Able to connect to production
❌  Unable to connect to development Error: Cannot connect over SSH using provided configuration.

Not sure I am setting up my ssh line for development correctly. Anyone have any pointers or can help guide me?

You can use trellis alias to generate the correct WP-CLI aliases

Great. I see it created wp-cli.trellis-alias.yml and then I copied the development lines over to wp-cli.yml.

It’s still able to connect to production and now it takes a lot longer to attempt to connect to development but eventually fails with the same error.

Running wp @development or wp @production results in:
Error: Cannot connect over SSH using provided configuration.

What does your aliases file look like?

What’s the error if you try to SSH into the VM using the same details from the alias?

trellis alias generated this for the development lines without any user defined.

@development:
  ssh: "newproject.test"
  path: "/srv/www/newproject.com/current/web/wp"

WIth vagrant, it would be vagrant@newproject.test right?

Not sure what I should be using here for Lima.


Running limactl show-ssh -f config newproject.com shows the user as my macOS username joshb as does the inventory file. I’ve tried using that as my user and it just hangs.

ssh joshb@newproject.test just hangs and eventually times out.

trellis vm shell immediately connects:

joshb@lima-client:/srv/www/newproject.com/current$ 

Alright, finally figured it out and connected via the sync script.

Need to us your macOS username@lima-[lima instance name], like so:

ssh joshb@lima-newproject.com

Trellis alias did not do that correctly afaict.

2 Likes

Glad you’re up and running!

I tested a fresh Lima install and using the generated file from trellis alias, which worked without any modifications — it’s possible there’s something in your SSH config that’s conflicting with it

1 Like

It worked without supplying a user?

Thanks for sharing the details how you got it to work!

1 Like