I’ve been reading up on the concept of dotfile management, and I’ve come across tools such as GNU Stow, chezmoi, and yadm, but before I select a tool, I’d like to understand the workflow a little better.

I understand if the dotfiles are in some cloud provider such as GitHub, then after a fresh install one can do git clone etc, but let’s say one’s dotfiles are not stored in the cloud, then what’s the workflow for getting those dotfiles onto the freshly installed OS? Do people do git clone from another machine on their local network, manually copy the dotfiles folder from the source, use an app like LocalSend, or something else?

EDIT: Clarifying that this is for a home environment, where I have two or three different laptops in service at any given time. One is my main daily driver and doesn’t change much. The other two are kinda my sandboxes and I’m often distro hopping on them. This question is mostly for distro hopping on my sandboxes, which is like once or twice a month. Thanks!

  • doodoo_wizard@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    4 小时前

    If you pay ten bucks you can get a vps with a few gigs of space for a year and just put your kilobyte of config files there. If you don’t want the malicious vps admin to crawl it you can encrypt a zip of them.

    It costs ten bucks but you get an offsite storage vault with a public ip and in some scenarios that’s desirable.

  • pinball_wizard@lemmy.zip
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    7 小时前

    If you have a network share available, it can be a git remote.

    cd NETWORKSHARE
    mkdir dotfiles.git
    cd dotfiles.git
    git init --bare
    
    cd $HOME/dotfiles
    git remote add origin NETWORKSHARE/dotfiles.git
    

    Then do git push and git pull operations as usual. The files at NETWORKSHARE/dotfiles.git will not be readable, but will have the full history of changes.

  • FishFace@piefed.social
    link
    fedilink
    English
    arrow-up
    7
    ·
    8 小时前

    let’s say one’s dotfiles are not stored in the cloud, then what’s the workflow for getting those dotfiles onto the freshly installed OS

    You’re just asking how to copy files from one computer to another. There is nothing specific to dotfiles here at all, right? So just do whatever you’d normally do for copying files?

    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      8 小时前

      True, although it’s not unusual for me to think I know all my options, and then discover new ideas by reading how other people do it. (I mean in general, not specific to copying files from one machine to another)

  • Tharkys@lemmy.wtf
    link
    fedilink
    arrow-up
    9
    ·
    17 小时前

    So, I have been wondering how distro hoppers handle setting up the system after an install… Going by this thread, it sounds like it is just a matter of stashing the config files somewhere else and then restoring them afterwards?

    What about applications? I assume those need to be reinstalled and configs restored as well, or is it all manual after getting the OS set up?

    One last question, does anyone have a link to an article explaining the process?

    • Kr4u7@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      11 小时前

      As a former distro hopper: i just partitioned my drives with /, /home and /opt and only replaced the root partition - yes I had a lot of config files that weren’t needed, but one could use scripts to help with that.

      Then some scripts to reinstall the programs need and resetup /opt and i was ready to go. For my pis am doing it with ansible.

    • Unusable 3151 ⁂@lemmy.ml
      link
      fedilink
      arrow-up
      8
      ·
      15 小时前

      you can go crazier and use ansible or even just switch to NixOS if you want to have your entire system defined in configuration files. I use NixOS.

      • AHemlocksLie@lemmy.zip
        link
        fedilink
        arrow-up
        1
        ·
        6 小时前

        NixOS is great. I love just how extensively you can configure a system by simply dropping in a config file. If I have to set up a new system, I usually work it out in a VM, then just copy the config files onto the system’s fresh NixOS install and have it almost entirely set up in minutes.

  • kumi@feddit.online
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    14 小时前

    You could self-host a shared “source of truth” git repo that you access over ssh or filesystem. That can be anything from a USB thumb drive, a small clean server or a container on your existing desktop with ssh access, to an entire Forgejo deployment. Then you only need the “secret zero” of an ssh key to get everything set up and syncable.

    If fresh setup is more common, you probably have other parts like package installation and network configuration that you also want to automate. Enter configuration management like ansible or salt, image builders like packer or archiso, “immutable” solutions like Nix or rpm-ostree. Once you get there you typically manage that in git anyway and you could put your dotfiles repo as a submodule and copy them over as part of OS setup.

    If it’s just for once in a blue moon, manual ad-hoc copying gets you pretty far.

    No matter how you slice it I think you have to either frequently spend time syncing changes or just accept the drift and divergence between machines and the sources.

    • ashx64@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      7 小时前

      Then you only need the “secret zero” of an ssh key to get everything set up and syncable

      I made a script just for this purpose, I run the script on a fresh system and it pulls my stow directory without me needing to manually mess with ssh keys or passwords.

      On a flashdrive, I have a folder named “setup”. In that folder, I have this script called “run” and a directory called “ssh”. In that “ssh” folder (not to be confused with ~/.ssh), I put my private ssh keys and their pubs.

      #!/bin/bash
      
      # stop script immediately on error
      set -e
      
      # change working directory to directory containing this script
      cd "$(dirname "$0")"
      
      # check that ./ssh exists and exit if not
      if [ ! -d ./ssh ]; then
          echo "./ssh not detected, exiting..."
          exit 1
      fi
      
      # create .ssh directory
      [ ! -d $HOME/.ssh ] && mkdir $HOME/.ssh
      chmod 700 $HOME/.ssh
      
      # copy keys to ~/.ssh
      cp -a ./.ssh/. $HOME/.ssh/
      
      # ensure right permissions for .ssh contents
      # note: 2>/dev/null suppresses errors if no .pub files exist, || true to avoid exiting on failure
      chmod 600 $HOME/.ssh/*
      chmod 644 $HOME/.ssh/*.pub 2>/dev/null || true
      
      # start ssh agent
      eval `ssh-agent -s`
      trap "ssh-agent -k" EXIT
      
      # add keys
      ssh-add "$HOME/.ssh/privatesshkey"
      
      # add known hosts
      # note: removing them first then adding again to avoid duplicate entries
      ssh-keygen -R codeberg.org 2>/dev/null || true
      ssh-keygen -R github.com 2>/dev/null || true
      ssh-keyscan -H codeberg.org >> $HOME/.ssh/known_hosts
      ssh-keyscan -H github.com >> $HOME/.ssh/known_hosts
      
      # clone repo
      cd $HOME
      if [ -d "$HOME/stow" ]; then
          TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
          mv "$HOME/stow" "$HOME/stow.old.$TIMESTAMP"
      fi
      git clone ssh://git@gitprovider.domain/myusername/stow.git
      
  • MalReynolds@slrpnk.net
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    20 小时前

    Easy enough to put a repo on a usb drive if that’s what you want, or indeed if you build the folder structure you can just copy. Fine for the occasional install, if you’re doing it wholesale, Ansible.

    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      20 小时前

      This is for the occasional install in a home environment on some extra laptops I have around the house. I updated the OP to clarify my use case. Thanks!

  • cravl@slrpnk.net
    link
    fedilink
    arrow-up
    3
    ·
    17 小时前

    I use chezmoi which syncs via my private Gitea instance. I can’t imagine not using a VCS for dotfiles, the number of times I’ve edited my ZSH aliases file or my VSCodium settings.json on both my desktop and my laptop and then had to merge the changes together is… a lot. A new setup is as simple as installing chezmoi, logging in to Bitwarden, downloading my Gitea SSH key, and cloning. The templates handle customizing things to the platform I’m on. I can do it over HTTPS using any backend the Git credential store supports too.

    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 小时前

      A new setup is as simple as installing chezmoi, logging in to Bitwarden, downloading my Gitea SSH key, and cloning.

      Thanks for sharing your workflow. I might be getting into the weeds a little bit, but for a new setup do you install your apps first and then clone your dotfiles or vice versa?

      • cravl@slrpnk.net
        link
        fedilink
        arrow-up
        2
        ·
        5 小时前

        It doesn’t usually matter, though you could have a script in your dotfiles to bootstrap the installation of everything needed. I haven’t bothered because I very rarely set up new machines, but for a VM warrior that’s what I would recommend for sure. You can use chezmoi templates to automatically use apt/dnf/yum/zypper/brew/whatever and export different envs depending on your platform and shell.

  • chrash0@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    20 小时前

    i host my dotfiles on GitHub, but any cloud provider or self-hosted git instance will do. otherwise, rsync, scp, or a good old fashioned thumb drive

    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      8 小时前

      Yeah, so far I’m leaning toward setting up a USB thumb drive that I always keep up to date so that I can plug it in when I do a fresh install.

      In your case, are you more often pulling from GitHub to update existing setups as your configs change over time or are you usually pulling your dotfiles onto a new setup?

      • chrash0@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        6 小时前

        normally it’s for syncing across machines, but it is convenient for setting up new machines. i use chezmoi and Nix and some other tools to keep things in sync

    • Amju Wolf@pawb.social
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      18 小时前

      You know you can just use git directly, right? That’s kinda its whole point, that it’s a self-contained topl for source distribution.

      You can laterally just git pull from any machine through SSH…

  • ashx64@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    19 小时前

    I’ve been happy with GNU Stow. Super simple and clean. I keep all the files in ~/stow and follow this workflow. You can avoid the git bits if you want and update ~/stow however you want.

    cd ~/stow
    
    # pull latest changes from git provider for syncing
    git fetch
    git status
    git pull
    
    # if made any edits and wanted to push them
    git add .
    git push origin main
    
    # do a dry run of stow just to make sure it won't do anything weird
    stow -n -v --no-folding .
    
    # do a real run of stow if nothing is wrong
    # note: --no-folding prevents folders from becoming symlinked, only files will be symlinks,
    # this prevents unintended files from going into ~/stow
    stow -v --no-folding .
    
    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      8 小时前

      Thanks for sharing your workflow. How often do you use this workflow? And are you more often cloning your dotfiles for a new setup or just keeping them updated across existing setups over time?

  • xia@lemmy.ca
    link
    fedilink
    English
    arrow-up
    2
    ·
    19 小时前

    With yadm, your dotfiles are in a git repo, so you can “host” them wherever you want (another machine, “the cloud”, usb drive, a bunch of floppies…)

  • Grimm665@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    2
    ·
    20 小时前

    Ansible or other IaC is a great choice. If your needs are real simple, like mine, i put Gitolite on one of my mini servers and i can push/pull from there over ssh.

    • yo_scottie_oh@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 小时前

      Gotcha. I don’t have a home server yet, but that is in my backlog of projects for 2026. In your case, are you more often pulling from your mini server to update existing setups as your configs change over time or are you usually pulling your dotfiles onto a new setup?

  • Theoriginalthon@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    21 小时前

    I usually don’t bother with most dot files, if any at all. If I’m copying anything local it’s just easier to use scp on the file, or tar a group then scp it where I want. Obviously you need ssh installed

  • erpicht@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    19 小时前

    I use GNU Stow for mine so the dotfiles I care about are included in my file-level backups. Once I restore my files, I can just run the stow(8) command to create the symbolic links. But, if I just want the dotfiles without the rest of my files, I would use scp(1) to copy the stow directory over to a new system, because it would be simplest. I don’t use version control with my stow directory (yet).