User Tools

Site Tools


git_adding_remotes

This is an old revision of the document!


Overview

How to add, use and delete remotes, using Linux kernel source repo as an example.

Add a new remote

Currently one remote:

$ git remote -v
origin	https://github.com/torvalds/linux.git (fetch)
origin	https://github.com/torvalds/linux.git (push)
$

Query linux-next before adding it as a remote:

$ git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Add as a new remote with name ln:

$ git remote add ln https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

There are no new branches yet:

$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
$

But we have a new registered remote:

$ git remote -v
ln	https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (fetch)
ln	https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (push)
origin	https://github.com/torvalds/linux (fetch)
origin	https://github.com/torvalds/linux (push)
$

Fetching the new remote

Count the current objects:

$ git count-objects -v
count: 0
size: 0
in-pack: 6542717
packs: 1
size-pack: 2684971
prune-packable: 0
garbage: 0
size-garbage: 0
$


git_adding_remotes.1552046394.txt.gz · Last modified: 2019/03/08 11:59 by rpjday