Remote
一句话解释
remote 是 named 引用 到 仓库 hosted elsewhere (e.g. on GitHub) 那个 你 能 推送 到 and 拉取 从.
用大白话说
remote 是指针到 version 的你的仓库那个 lives on another 服务器 — 大多数通常 GitHub, GitLab, or Bitbucket. 你的局部仓库能 有多个 remotes, 每个使用 name. 默认 remote 创建通过 git clone 是 called origin.
Remotes are how local and server copies stay in sync. git 推送 sends your local commits to a remote; git 拉取 fetches and merges commits from a remote into your local branch. Without a remote, your repository is isolated on your machine.
You can add remotes with git remote 添加 <name> <URL>, list them with git remote -v, and remove them with git remote 移除 <name>. A common setup is 原点 pointing to your fork and upstream pointing to the original project you forked from.
示例
# List configured remotes
git remote -v
# Add a new remote
git remote add upstream https://github.com/original/project.git
# Push to a specific remote
git push origin main
# Pull from upstream
git pull upstream main原点 是 默认 remote. 你 能 添加 更多 (e.g. upstream) and 推送/拉取 从 任何 的 它们.
相关术语
相关资源
相关课程
- GitHub 基础
Remotes and GitHub
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。