{"id":16779030,"url":"https://github.com/liby/dotfiles","last_synced_at":"2025-04-10T20:52:20.954Z","repository":{"id":243268627,"uuid":"811638636","full_name":"liby/dotfiles","owner":"liby","description":"🔧 My development environment and config","archived":false,"fork":false,"pushed_at":"2025-04-01T03:52:48.000Z","size":49,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T04:02:52.209Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liby.png","metadata":{"files":{"readme":".github/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-06-07T02:10:45.000Z","updated_at":"2025-04-01T03:52:51.000Z","dependencies_parsed_at":"2024-08-11T10:26:05.414Z","dependency_job_id":"1cc4966a-6fe0-4532-a3ce-107b88a7f902","html_url":"https://github.com/liby/dotfiles","commit_stats":null,"previous_names":["liby/dotfiles"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liby%2Fdotfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liby%2Fdotfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liby%2Fdotfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liby%2Fdotfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liby","download_url":"https://codeload.github.com/liby/dotfiles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248297011,"owners_count":21080309,"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","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":"2024-10-13T07:29:13.428Z","updated_at":"2025-04-10T20:52:20.892Z","avatar_url":"https://github.com/liby.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch4 align=\"right\"\u003e\n  \u003cstrong\u003e简体中文\u003c/strong\u003e | \u003ca href=\"https://github.com/liby/dotfiles/blob/main/.github/README_EN.md\"\u003eEnglish\u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cdiv\u003e\n  \u003ch1 align=\"center\"\u003eMy Dotfiles\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003e **Note**\n\u003e\n\u003e 这是我个人的 dotfiles 仓库，用于配置和管理我的开发环境。通过这个仓库，我可以轻松地在多台 Mac 之间保持一致的开发环境配置。\n\n## 项目简介\n\n本仓库包含了一系列配置文件和脚本，用于设置和管理我的开发环境，包括但不限于：\n\n  - Git 配置，如： [_.config/git_](https://github.com/liby/dotfiles/tree/main/.config/git)\n\n  - Homebrew 备份文件：[_Brewfile_](https://github.com/liby/dotfiles/blob/main/Brewfile)\n\n  - Shell 配置，如：[_.zshrc_](https://github.com/liby/dotfiles/blob/main/.zshrc)\n\n  - SSH 配置，如：[_.ssh/config_](https://github.com/liby/dotfiles/blob/main/.ssh/config)\n\n  - 开发环境的初始化脚本：[_.config/scripts/macos-bootstrap.zsh_](https://github.com/liby/dotfiles/blob/main/.config/scripts/macos-bootstrap.zsh)\n\n  - 终端配置，如：[_.config/starship_](https://github.com/liby/dotfiles/tree/main/.config/starship)\n\n这些文件是通过 Git Bare Repo 来管理的，这种方法使我能在保持 `$HOME` 目录整洁的同时又能使用 Git 来管理配置文件。如果你对这其中的缘由感兴趣，又想了解使用 Git Bare Repo 管理 dotfiles 的更多信息，欢迎阅读我之前写的一篇[分享文档](https://note.itswhat.me/#/page/%E4%BD%BF%E7%94%A8%20git%20bare%20repo%20%E6%9D%A5%E7%AE%A1%E7%90%86%20dotfiles)。\n\n## 安装说明\n\n### 1. 克隆仓库\n\n首先，克隆本仓库到本地：\n\n```sh\ngit clone --bare \u003cgit_url\u003e $HOME/.dotfiles\n```\n\n### 2. 定义别名\n\n为了更方便地管理 dotfiles，你可以添加以下别名到你的 shell 配置文件（如 _.zshrc_ 或 _.bashrc_）：\n\n```sh\nalias dot='$(command -v git) --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'\n```\n\n然后，重新加载你的 shell 配置：\n\n```sh\nsource ~/.zshrc  # 如果你使用的是 Zsh\n# 或者\nsource ~/.bashrc  # 如果你使用的是 Bash\n```\n\n### 3. 隐藏未跟踪文件\n\n为了避免在使用 `dot` 命令时看到未跟踪的文件列表，可以使用以下命令：\n\n```sh\ndot config --local status.showUntrackedFiles no\n```\n\n如果不设置的话，执行 `dot status` 命令时会显示大量未跟踪的文件。这是因为 `$HOME` 目录下的文件默认都还没有被 Git 纳入管理，而我们实际上只需要管理特定的配置文件。\n\n### 4. 检出文件\n\n使用以下命令将仓库中的文件检出到你的 `$HOME` 目录：\n\n```sh\ndot checkout\n```\n\n如果遇到文件冲突，比如下面这种报错：\n\n```\nerror: The following untracked working tree files would be overwritten by checkout:\n  .zshrc\nPlease move or remove them before you can switch branches.\nAborting\n```\n\n可以先备份已有的配置文件：\n\n```sh\nmkdir -p .dotfiles-backup\ndot checkout 2\u003e\u00261 | egrep \"\\s+\\.\" | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backupp/{}\n```\n\n然后再次尝试检出文件：\n\n```sh\ndot checkout\n```\n\n## 使用方法\n\n你可以使用以下命令来管理你的 dotfiles：\n\n```sh\ndot add \u003cfile\u003e：添加文件到仓库\ndot commit -m \"message\"：提交更改\ndot remote add origin \u003cgit_url\u003e：配置远程仓库\ndot push -u origin \u003cbranch\u003e：推送 commit 到远程仓库，同时将远程仓库与本地的 branch 分支关联\ndot push：推送更改到远程仓库\ndot pull：从远程仓库拉取更新\n```\n\n## 快捷方式（可选）\n\n以上步骤中包含了一些不常用的命令，步骤也较为繁琐，可能不太容易记住。为了简化这个过程，我们可以创建一个自动化脚本，就像 [The best way to store your dotfiles: A bare Git repository](https://www.atlassian.com/git/tutorials/dotfiles#:~:text=you%20can%20create%20a%20simple%20script) 中提到的做法：\n\n  1. 创建一个自动化脚本\n\n  2. 将其存储为代码片段，可以使用 https://paste.gg/ 之类的网站\n\n  3. 为其创建一个短链接\n\n我自己也有一个用于配置开发环境的[初始化脚本](https://github.com/liby/dotfiles/blob/main/.config/scripts/macos-bootstrap.zsh)，当我拿到一台新的 Mac 时，只需要打开 Terminal.app，运行下面的命令即可完成开发环境的设置：\n\n```sh\ncurl -o /tmp/macos-bootstrap.zsh https://raw.githubusercontent.com/liby/dotfiles/main/.config/scripts/macos-bootstrap.zsh \u0026\u0026 chmod +x /tmp/macos-bootstrap.zsh \u0026\u0026 /tmp/macos-bootstrap.zsh\n```\n\n非常方便。\n\n## 贡献指南\n\n如果你有任何改进建议或发现了问题，欢迎提交 Issue 或 Pull Request。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliby%2Fdotfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliby%2Fdotfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliby%2Fdotfiles/lists"}