{"id":23978715,"url":"https://github.com/rishav394/config-files-backup","last_synced_at":"2025-09-11T01:07:41.271Z","repository":{"id":270391198,"uuid":"909779345","full_name":"rishav394/config-files-backup","owner":"rishav394","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-31T06:50:53.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T04:26:24.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rishav394.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-29T18:44:59.000Z","updated_at":"2024-12-31T06:50:57.000Z","dependencies_parsed_at":"2025-01-07T08:35:46.474Z","dependency_job_id":null,"html_url":"https://github.com/rishav394/config-files-backup","commit_stats":null,"previous_names":["rishav394/config-files-backup"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/rishav394/config-files-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishav394%2Fconfig-files-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishav394%2Fconfig-files-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishav394%2Fconfig-files-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishav394%2Fconfig-files-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rishav394","download_url":"https://codeload.github.com/rishav394/config-files-backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishav394%2Fconfig-files-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274557583,"owners_count":25307516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-07T08:35:45.684Z","updated_at":"2025-09-11T01:07:41.220Z","avatar_url":"https://github.com/rishav394.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Config Files Backup Script\n\nThis script automates the process of backing up essential configuration files and directories from your home directory to a remote GitHub repository. It uses `rsync` to copy files and directories, ensuring that the structure and permissions are preserved.\n\n---\n\n## Features\n\n- Backs up important files and directories, including shell configurations, SSH keys, Kubernetes configs, and more.\n- Supports the use of `rsync` for efficient and reliable file transfers.\n- Initializes a Git repository and pushes the backup to a remote repository on GitHub.\n- Handles globs for directories (e.g., `.zsh*`, `.config/*`), allowing you to back up multiple related files.\n- Allows for easy restoration by cloning the GitHub repository to another machine.\n\n---\n\n## Prerequisites\n\nBefore running the script, ensure that the following requirements are met:\n\n- **`rsync` Version**: The script checks that your `rsync` version is greater than 3.0. If it's not, you may need to install or update it using Homebrew.\n- **GitHub Repository**: The script pushes the backup to a GitHub repository. You need to create a repository and update the `GITHUB_REPO_URL` variable with the appropriate URL. Make sure this is not a public repository.\n\n---\n\n## Files and Directories Included\n\nBy default, the script backs up the following files and directories from your home directory:\n\n- Shell Configuration Files:\n  - `.bashrc`\n  - `.zshrc`\n  - `.zsh*`\n- Git Configuration:\n  - `.gitconfig`\n- SSH Configuration:\n  - `.ssh/*`\n- AWS Configuration:\n  - `.aws/`\n- Kubernetes Configurations:\n  - `.kube/config`\n  - `.kube/grofers-k8s-config`\n- Other Config Files:\n  - `.config/kafkactl/*`\n  - `.config/gh/*`\n  - `.config/iterm2/*`\n  - `.config/JetBrains`\n  - `.config/Code/User/settings.json`\n  - `.npmrc`\n\nFeel free to add additional files or directories to the `CONFIG_ITEMS` array in the script to customize what gets backed up.\n\n---\n\n## Installation and Setup\n\n1. **Clone the Repository:**\n\n   Clone the repository to your local machine where the script will be executed:\n\n   ```bash\n   git clone https://github.com/rishav394/config-files.git\n   cd config-files\n   ```\n\n2. **Update `GITHUB_REPO_URL`:**\n\n   Open the script and ensure the `GITHUB_REPO_URL` variable points to the correct repository URL:\n\n   ```bash\n   GITHUB_REPO_URL=\"git@github.com:rishav394/config-files.git\"\n   ```\n\n3. **Check `rsync` Version:**\n\n   The script uses `rsync` to handle file copying. Ensure that your `rsync` version is greater than 3.0. To check your `rsync` version:\n\n   ```bash\n   rsync --version\n   ```\n\n   If it's older, you can install it using Homebrew:\n\n   ```bash\n   brew install rsync\n   ```\n\n4. **Make the Script Executable:**\n\n   Grant execute permissions to the script:\n\n   ```bash\n   chmod +x backup.sh\n   ```\n\n---\n\n## Running the Script\n\nTo run the backup script manually:\n\n```bash\n./backup.sh\n```\n\n### Scheduled Backups (Optional)\n\nYou can schedule this script to run automatically at regular intervals using `cron` or other task schedulers. For example, to run the script every 6 hours, you can add it to your crontab:\n\n```bash\ncrontab -e\n```\n\nThen add the following line to run the script every 6 hours:\n\n```bash\n0 */6 * * * /path/to/backup.sh\n```\n\n---\n\n## How It Works\n\n1. **Backup Process**: The script creates a backup directory (`$HOME/config-files`) and copies the files and directories listed in `CONFIG_ITEMS` to that directory.\n2. **Git Initialization**: If a Git repository doesn't already exist in the backup directory, the script will initialize it, set the remote repository, and pull the latest changes from the specified branch.\n3. **Commit and Push**: The script stages the changes, commits them with a message, and pushes them to the specified GitHub repository.\n\n---\n\n## Customization\n\n- **Add/Remove Files**: You can customize the list of files and directories to back up by modifying the `CONFIG_ITEMS` array in the script.\n- **Commit Message**: The commit message is automatically generated with the current date, but you can customize it by modifying the `COMMIT_MESSAGE` variable.\n- **Git Branch**: By default, the script uses the `main` branch for backups. You can change the `BRANCH` variable to use a different branch.\n\n---\n\n## Troubleshooting\n\n- **Missing Files**: If certain files or directories are not found, the script will print a warning but will continue with the backup process. Ensure the paths to the files are correct and that they exist on your system.\n- **Permissions**: Ensure that you have the necessary permissions to read the files you want to back up and write to the backup directory.\n\n---\n\n## License\n\nThis script is released under the [MIT License](LICENSE). Feel free to fork, modify, and use it as you like.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishav394%2Fconfig-files-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishav394%2Fconfig-files-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishav394%2Fconfig-files-backup/lists"}