ddworken / hishtory

Your shell history: synced, queryable, and in context
https://hishtory.dev
MIT License
2.43k stars 41 forks source link

Add Server & Keep History #182

Open Dashboy1998 opened 5 months ago

Dashboy1998 commented 5 months ago

I am currently using hishtory with a local file.

I have a hishtory server setup, the linuxserver.io image. But I'm not sure how to sync my current history with the server.

It appears running hishtory init ${SECRET_KEY} will erase my current history.

ddworken commented 5 months ago

Thanks for opening this issue! Currently, there isn't a clean way of doing this (though this is a great feature request that I will work on!). But if you're up for a hacky way of doing this, you should be able to:

  1. Back up your ~/.hishtory/ directory to somewhere safe, this contains everything you need
  2. Reinstall hishtory with it configured to use your API server that you set up
  3. Copy over the DB files from the backup. This is all of the .hishtory.db* star files that are in your backed up ~/.hishtory/ folder.
  4. Run hishtory reupload to re-upload all of the entries that are now in the DB

I think this should work. And if it doesn't work for some reason, you can always just restore the entire ~/.hishtory/ directory which will definitely work to serve as a backup.

dstengle commented 4 months ago

Is there some reason you couldn't do a hishtory export, reinstall with sync and then do an import from the cli?