Skip to content

Bare 仓库

一句话解释

bare 仓库有 否工作 directory — 它仅 包含 .git 数据. 它是 used as remote for pushing and pulling.

用大白话说

bare 仓库是 Git 仓库那个有 否工作 directory — 它仅 包含内容的 .git folder, 不 checkout 的 files. 你 cannot 编辑 files or 运行 git add in a bare repo.

Bare repositories are used as central remotes (like a GitHub server). Developers push to and pull from them, but no one works directly in them. Creating a bare repo with git init --bare sets it up for this purpose.

The convention is to name bare repositories with a .git suffix (e.g. 项目.git). When you clone, Git creates a normal (non-bare) repository with a working directory from the bare remote.

示例

bash
# Create a bare repository
git init --bare project.git

# Clone from it (creates a normal repo with working directory)
git clone project.git my-project
cd my-project
# Now you can edit, add, commit, and push back

Bare 仓库是 for pushing/pulling; 它们有 否工作 directory.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表