{"id":33108,"date":"2025-05-16T21:05:57","date_gmt":"2025-05-17T00:05:57","guid":{"rendered":"https:\/\/mastertrend.info\/?p=33108"},"modified":"2026-04-28T13:19:08","modified_gmt":"2026-04-28T16:19:08","slug":"dotfiles-on-github","status":"publish","type":"post","link":"https:\/\/mastertrend.info\/en\/dotfiles-en-github\/","title":{"rendered":"Dotfiles on GitHub: Manage Linux easily and quickly! \ud83d\ude80\ud83d\udcbb"},"content":{"rendered":"<h2>Dotfiles on GitHub: 3 reasons not to waste time \u23f3\ud83d\udd25<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/mastertrend.info\/wp-content\/uploads\/2025\/01\/Por-que-deberias-mantener-todos-tus-dotfiles-de-Linux-en.jpg\" alt=\"\" title=\"\"><\/p>\n<div>\n<section class=\"emaki-custom-block emaki-custom-key-points\">\n<div id=\"custom_block_0\" class=\"emaki-custom key-points\">\n<h3 class=\"title icon i-list\">Summary<\/h3>\n<div class=\"custom_block-content key-points\">\n<ul>\n<li>Managing dotfiles with Git can save you time and provide a robust backup option.<\/li>\n<li>Storing dotfiles in a version control system (VCS) like Git ensures a consistent configuration across multiple machines. \ud83d\udcbb<\/li>\n<li>Using GitHub to host your dotfiles makes sharing and collaboration easier. \ud83e\udd1d<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/section>\n<p><!-- No se inyectan anuncios por estar en modo sin anuncios. --><\/p>\n<p>Dotfiles are an accessible and powerful way to <a href=\"https:\/\/mastertrend.info\/en\/ubuntu-configurations-that-improve\/\" title=\"Ubuntu settings that improve your experience: Learn the 7 secrets\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"6359\">configure your Linux system<\/a>But how can you keep track of them all and reuse them when you need them? Try Git. \ud83d\ude80<\/p>\n<p><!-- No se inyectan anuncios por estar en modo sin anuncios. --><\/p>\n<h2 id=\"what-are-dotfiles\">What Are Dotfiles?<\/h2>\n<p>In <a class=\"wpil_keyword_link\" href=\"https:\/\/mastertrend.info\/en\/llinux-directory-structure\/\" target=\"_blank\"  rel=\"noopener\" title=\"The Linux directory structure, explained\" data-wpil-keyword-link=\"linked\"  data-wpil-monitor-id=\"32833\">Linux<\/a>, cualquier archivo cuyo nombre comience con un \u00ab.\u00bb es un archivo oculto. Por defecto, no se mostrar\u00e1 en tu gestor de archivos ni en un listado de comandos en la terminal.<\/p>\n<p>Some Linux programs use hidden files for configuration, often placing them in your home directory. This is a useful setup because it keeps the settings out of your way while ensuring they remain accessible. Since these settings are in plain text files, they&#039;re easy to read and edit. Additionally, you can use Linux command-line tools to work with your system&#039;s settings.<\/p>\n<p>Common examples of dotfiles include:<\/p>\n<ul>\n<li>.bashrc, .zshrc<\/li>\n<li>.exrc<\/li>\n<li>.gitconfig<\/li>\n<li>.npmrc<\/li>\n<\/ul>\n<h2 id=\"how-can-git-or-github-help\">How Can Git or GitHub Help You?<\/h2>\n<p>Dotfiles are great, but they&#039;re system-specific. When you need to replace your computer, use a secondary device, or access a remote server, you might find yourself setting everything up again.<\/p>\n<p>Almacenar tus dotfiles en un VCS (Sistema de <a href=\"https:\/\/mastertrend.info\/en\/git-vs-github\/\" title=\"Git vs GitHub: Which one to choose today? \ud83d\udd25\" target=\"_blank\" rel=\"noopener\"  data-wpil-monitor-id=\"34632\">Control de Versiones<\/a>) puede ayudarte a evitar esta tarea repetitiva, permiti\u00e9ndote reutilizar instant\u00e1neamente tu configuraci\u00f3n en otra m\u00e1quina. Solo tienes que clonar tu repositorio y obtendr\u00e1s los mismos alias de shell, temas familiares y un comportamiento consistente. \ud83d\udd04<\/p>\n<p>Additionally, storing dotfiles in Git is a robust backup option. You can even review your repository&#039;s history to discover when\u2014and why\u2014you changed a specific setting. In a collaborative environment, you can even share your dotfiles via Git to ensure everyone on the team has a consistent environment. \ud83d\udc65<\/p>\n<p>For this, GitHub is the best of the best. If you have another place to host your Git repository, you can certainly do that, but GitHub makes it much easier. \ud83c\udf10<\/p>\n<h2 id=\"the-best-way-of-managing-your-dotfiles-with-git-and-github\">The Best Way to Manage Your Dotfiles with Git and GitHub<\/h2>\n<p>First, understand that any way you can store your dotfiles in Git will be a huge advantage. There are specific details about the best way to do this, but if you can store a file in Git, update it, and retrieve it, you&#039;ll benefit significantly from managing your dotfiles this way. \ud83d\udcc8<\/p>\n<p>However, the following approach is widely recommended online, and it works for me. This particular setup should help you keep everything in sync with minimal effort. \ud83e\udd13<\/p>\n<h3 id=\"set-up-a-bare-repository-and-some-scaffolding\">Set up a Basic Repository and Some Structure<\/h3>\n<p>Since your home directory likely has a lot of stuff you don&#039;t want in your dotfiles repository, it&#039;s best to avoid a standard setup. Instead, you can manage your dotfiles in a basic repository. \ud83c\udfd7\ufe0f<\/p>\n<p>A bare repository is like a regular repository, but without the project files. It has all the Git metadata describing the history of those files; it just doesn&#039;t contain the files themselves. The files can live elsewhere, in your working directory, and you&#039;ll only use the bare repository to manage them.<\/p>\n<p>Start by creating a basic repository in a new location, for example:<\/p>\n<pre><code class=\"hljs bash\">mkdir <span class=\"hljs-variable\">$HOME<\/span>\/.dotfiles git init --bare <span class=\"hljs-variable\">$HOME<\/span>\/.dotfiles\r\n<\/code><\/pre>\n<p>When working with this repository, you&#039;ll need to provide a working directory (for the files) and a git directory (for the repository itself):<\/p>\n<pre><code class=\"hljs bash\">git --work-tree=<span class=\"hljs-variable\">$HOME<\/span> --git-dir=<span class=\"hljs-variable\">$HOME<\/span>\/.dotfiles ...\r\n<\/code><\/pre>\n<p>Instead of typing this every time you use Git, it makes sense to set up an alias. You can also provide the path to the base repository so you can use it from any directory:<\/p>\n<pre><code class=\"hljs bash\"><span class=\"hljs-built_in\">alias<\/span> dotfiles=<span class=\"hljs-string\">&quot;\/usr\/bin\/git --git-dir=<span class=\"hljs-variable\">$HOME<\/span>\/.dotfiles --work-tree=<span class=\"hljs-variable\">$HOME<\/span>\"<\/span> \r\n<\/code><\/pre>\n<h3 id=\"store-your-dotfiles\">Store Your Dotfiles<\/h3>\n<p>Start by identifying a dotfile that you want to version control.<\/p>\n<p>Then you can run these commands to start <a title=\"systemctl: Total Control in Linux in 12 Steps\" href=\"https:\/\/mastertrend.info\/en\/systemctl\/\" target=\"_blank\" rel=\"noopener\" data-wpil-monitor-id=\"5760\">control your file<\/a> .bashrc, for example:<\/p>\n<pre><code class=\"hljs bash\"><span class=\"hljs-built_in\">CD<\/span>\u00a0<span class=\"hljs-variable\">$HOME<\/span>\r\ndotfiles add .bashrc dotfiles commit -m <span class=\"hljs-string\">&quot;Bash Execution Control File&quot;<\/span>\r\n<\/code><\/pre>\n<p>Aparte de usar el alias dotfiles en lugar del <a class=\"wpil_keyword_link\" href=\"https:\/\/mastertrend.info\/en\/10-basic-git-commands\/\" target=\"_blank\" rel=\"noopener\" title=\"10 Basic Git Commands Every Developer Needs \ud83d\udda5\ufe0f\" data-wpil-keyword-link=\"linked\" data-wpil-monitor-id=\"6981\">comando git<\/a> com\u00fan, puedes utilizar git para rastrear estos archivos tal como lo har\u00edas normalmente. Esta forma es en realidad un poco m\u00e1s f\u00e1cil porque puedes ejecutar un comando como \u00abdotfiles log\u00bb desde cualquier directorio. \ud83d\udcdc<\/p>\n<h3 id=\"upload-your-repository-to-github\">Upload Your Repository to GitHub<\/h3>\n<p>You may find it convenient to host your repository on a provider like GitHub. This makes it easier to share access to your dotfiles, especially from machines on a different network. It&#039;s easy to do, even with an existing repository:<\/p>\n<ol>\n<li>Comienza en la p\u00e1gina Crear un Nuevo Repositorio.<\/li>\n<li>Enter a Name for the Repository.<\/li>\n<li>Choose between a Public or Private repository; Private is probably best (see below).<\/li>\n<li>Click Create Repository.<\/li>\n<\/ol>\n<p>At this point, you&#039;ll be shown a screen with setup instructions. To upload your existing repository, simply run these two commands:<\/p>\n<pre><code class=\"hljs bash\">dotfiles remote add origin https:\/\/github.com\/\/.git dotfiles push -u origin main\r\n<\/code><\/pre>\n<p>Where is your GitHub username and is the name you chose for your repository.<\/p>\n<section class=\"emaki-custom-block emaki-custom-warning\">\n<div id=\"custom_block_35\" class=\"emaki-custom warning\">\n<div class=\"custom_block-content warning\">\n<p>Be very careful when uploading your repository to GitHub: your dotfiles may contain sensitive data. Ideally, you should avoid compromising files containing passwords to any repository. If you can&#039;t avoid this, at least consider using a private GitHub repository; however, you&#039;ll need to pay for this. \u26a0\ufe0f<\/p>\n<\/div>\n<\/div>\n<\/section>\n<h3 id=\"use-on-another-system\">Use on Another System<\/h3>\n<p>To share your dotfiles on another machine, you&#039;ll need to repeat the above processes and clone the base repository. Specifically, this involves two important steps. First, clone a base copy of your repository:<\/p>\n<pre><code class=\"hljs bash\"><span class=\"hljs-built_in\">CD<\/span>\u00a0<span class=\"hljs-variable\">$HOME<\/span>\r\ngit <span class=\"hljs-built_in\">clone<\/span> --bare https:\/\/github.com\/\/.git\r\n<\/code><\/pre>\n<section class=\"emaki-custom-block emaki-custom-note\">\n<div id=\"custom_block_39\" class=\"emaki-custom note\">\n<div class=\"custom_block-content note\">\n<p>This will usually be cloned into a directory called .git. Once cloned, you&#039;re free to rename it.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<p>Recreate the alias you are using for git:<\/p>\n<pre><code class=\"hljs bash\"><span class=\"hljs-built_in\">alias<\/span> dotfiles=<span class=\"hljs-string\">&quot;\/usr\/bin\/git --git-dir=<span class=\"hljs-variable\">$HOME<\/span>\/.dotfiles --work-tree=<span class=\"hljs-variable\">$HOME<\/span>\"<\/span>\r\n<\/code><\/pre>\n<p>Now you can fill your working directory\u2014your HOME\u2014with your version-controlled dotfiles:<\/p>\n<pre><code class=\"hljs bash\">dotfiles checkout\r\n<\/code><\/pre>\n<p>At this point, you might see an error about overwriting working tree files. This is because you probably already have old or default dotfiles like .bashrc. Simply delete or move these files, and then checkout again. \ud83d\udd04<\/p>\n<hr \/>\n<p>Keeping track of your dotfile versions will save you a lot of hassle when updating or switching systems. You&#039;ll also be able to review a complete history and see when you changed what, and why. \ud83d\udcda<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Dotfiles on GitHub save you time and ensure secure backups. Control your Linux with a single click! \ud83d\udcbb\ud83d\udd04\u26a1<\/p>","protected":false},"author":1,"featured_media":49304,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ai_generated_summary":"","iawp_total_views":32,"jnews-multi-image_gallery":[],"jnews_single_post":[],"jnews_primary_category":[],"jnews_social_meta":[],"jnews_review":[],"enable_review":"","type":"","name":"","summary":"","brand":"","sku":"","good":[],"bad":[],"score_override":"","override_value":"","rating":[],"price":[],"jnews_override_counter":[],"footnotes":""},"categories":[1435],"tags":[1445,1821,1558],"class_list":["post-33108","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutoriales","tag-evergreencontent","tag-linux","tag-techtips"],"_links":{"self":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/33108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/comments?post=33108"}],"version-history":[{"count":9,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/33108\/revisions"}],"predecessor-version":[{"id":110082,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/posts\/33108\/revisions\/110082"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/media\/49304"}],"wp:attachment":[{"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/media?parent=33108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/categories?post=33108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mastertrend.info\/en\/wp-json\/wp\/v2\/tags?post=33108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}