Sign in
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Error using an `.ssh` key in an `sftp` deployment

  • This topic has 5 replies, 2 voices, and was last updated 11 months, 2 weeks ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #9471
    Avatar photomichaell

    I’m using `sftp` to deploy. I tried using an `ssh` key rather than a password, but I got an odd error saying that Publii could connect, but couldn’t write files. Switching from key to password worked, without changing anything else.

    For the key, I pointed to my `~/.ssh/id_rsa` file. That’s what I use when I connect from the command-line Am I doing something wrong? Does Publii expect, say, a particular key format that’s different than the one I’m using? Or… something?

    Is there a log file that could tell me what’s actually failing?


    P.S. I’m on macOS Ventura.

    Avatar photomichaell

    A bigger problem is that `sftp` deployments are unreliable.

    I quickly created a site for my wife’s paintings. When I deployed the site, the progress meter paused for a moment, then zoomed to 100%. But not all of the images were deployed. In fact, maybe none of them were. But re-deploying didn’t fix that.

    It seems like `sftp` deployment keeps a record of what it thinks it already deployed, and only re-deploys when it thinks those things have changed. And nothing — not even the absence of the files on the server! — can change its mind.

    (I used `rsync` to upload the site instead.)

    Avatar photomichaell

    I logged a bug here describing theses issues in some detail.

    Avatar photoitips3727

    I’ve been using SFTP deployment with keys, not password, for several years now with Publii, thankfully without any problems. So this has worked flawlessly during multiple Publii updates and theme updates. From my experience, once set up, it’s a joy to work with. I too am on macOS Ventura. I generate the keys using standard tools for this purpose at my web host (shared hosting). It sounds like your install is more complex. So if you could provide more information on your install, maybe someone else on the forum could help further.

    Avatar photomichaell

    Thanks. I switched to Cloudflare Pages, using Direct Uploads. (I do a manual deploy, and then use a terminal command to upload directly to Cloudflare, without going through GitHub.)

    I don’t know if you looked at the bug, but I provided some details that I uncovered by looking at the code. While most of the details focus on what I meant by “unreliable,” I think the bit that I added at the end may explain what’s happening with the SSH key. Basically, promises aren’t being used quite right. When they aren’t used quite right, code can run in an unexpected order. As to why SSH is reliable for you but not for me: I suspect there are timing differences in the hosts we’re using. But, hey, that’s just a guess! If it would help I could investigate further.


    Avatar photoitips3727


    I’m not sure what else to suggest. It seems that a small number of web hosts may have more or less tolerance to timing differences. It’s also possible that if the Publii core was changed in the way you describe to resolve your problem, bizarrely, it might cause other problems for other users. Unfortunately, I don’t know enough about this area to make much more of a contribution. Though, to-date, I have used two separate web hosts for SFTP connections without any problems connecting and synchronising.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.