Skip to content

远程仓库

origin

当执行:

sh
git clone https://github.com/user/repo.git

Git 会自动帮你做一件事: 给这个远程仓库起名叫 origin。即origin 就是远程仓库地址的别名

操作

一个 Git 仓库完全可以绑定多个远程仓库。默认的远程仓库名为origin

  • 查看当前远程仓库
sh
 git remote -v
sh
origin    https://github.com/user/repo.git (fetch)
origin    https://github.com/user/repo.git (push)
backup    https://github.com/user/repo-backup.git (fetch)
backup    https://github.com/user/repo-backup.git (push)
  • 删除与远程仓库
sh
git remote rm 远程仓库名
  • 添加远程仓库
sh
git remote add backup https://github.com/xxx/backup.git
git remote add upstream https://github.com/xxx/original.git

最后更新于: