Skip to content

Ajayduddi/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation


Dotfiles Backup and Sync Guide

This guide will walk you through the steps to backup and sync your dotfiles using GitHub, so that you can easily manage your system configurations across multiple machines.

Table of Contents

  1. Introduction
  2. Getting Started
  3. Backing Up Dotfiles
  4. Syncing Dotfiles Across Multiple Machines

1. Introduction

Dotfiles are configuration files that are used by various tools and programs on your system, such as .bashrc, .vimrc, .zshrc, and more. Keeping your dotfiles in a GitHub repository allows you to:

  • Backup: Your configuration files are safely stored in the cloud.
  • Sync: Easily synchronize your settings across multiple systems.
  • Version Control: Track changes to your configuration over time.

In this guide, we'll cover how to back up your dotfiles to GitHub and sync them across different systems.


2. Getting Started

Before you start, you'll need the following:

  • A GitHub account (if you don’t have one, create one at GitHub).

  • Git installed on your system. If you don't have Git installed, you can install it via your package manager:

    • For Fedora: sudo dnf install git

    You'll also need a terminal for running the commands.


3. Backing Up Dotfiles

To back up your dotfiles, you'll first create a GitHub repository to store them.

  1. Create a GitHub repository:

    • Go to GitHub.
    • Click the New button to create a new repository.
    • Name the repository (e.g., dotfiles).
    • Choose to initialize the repository without a README or .gitignore.
    • Click Create repository.
  2. Clone the repository to your system:

    Open a terminal and clone the repository to your local machine:

    git clone https://github.com/YOUR_USERNAME/dotfiles.git ~/dotfiles
  3. Add your dotfiles: Move or symlink your configuration files to the ~/dotfiles directory.

    • A symbolic link is a special file that contains a path to another file or directory. Unlike hard links, symlinks can point to files or directories across different filesystems, and they can even point to non-existent files (they become "broken" symlinks in that case).

    • To copy the files:

      cp ~/.bashrc ~/dotfiles/
      cp ~/.vimrc ~/dotfiles/
    • To symlink the files (recommended for convenience):

      ln -s ~/dotfiles/.bashrc ~/.bashrc
      ln -s ~/dotfiles/.vimrc ~/.vimrc

      Syntax:

      cp [options] source destination
      ln -s [TARGET] [LINK_NAME]
    • TARGET: The file or directory the symlink points to (the original).

    • LINK_NAME: The name of the symlink you're creating.

    • source: The path to the file or directory you want to copy.

    • destination: The path where you want to copy the file or directory to.

  4. Commit and push your dotfiles:

    Add and commit the dotfiles to your repository:

    cd ~/dotfiles
    git add .
    git commit -m "Initial commit of dotfiles"
    git push origin master

Your dotfiles are now backed up on GitHub.


4. Syncing Dotfiles Across Multiple Machines

To sync your dotfiles across multiple systems, follow these steps on each new machine:

  1. Clone the repository:

    On your new machine, clone the repository to your home directory:

    git clone https://github.com/YOUR_USERNAME/dotfiles.git ~/dotfiles
  2. Create symlinks:

    Create symbolic links from your dotfiles to the appropriate locations:

    ln -s ~/dotfiles/.bashrc ~/.bashrc
    ln -s ~/dotfiles/.vimrc ~/.vimrc

    This will ensure that your configurations are synced with the dotfiles repository.

  3. Pull updates:

    If you make changes to your dotfiles on one machine, simply commit and push those changes to GitHub:

    cd ~/dotfiles
    git add .
    git commit -m "Updated .bashrc for new settings"
    git push

    On another machine, run:

    cd ~/dotfiles
    git pull origin master

    This will fetch the latest changes and update your dotfiles.


About

GNU Stow–based dotfiles repo with backup/restore scripts, package recovery, firewall automation, and security guardrails for reproducible Linux setups, safer syncing, and reliable environment restoration.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Contributors