Quelle descritte nei capitoli precedenti, ed altre modalità di collaborazione sono possibili grazie ai tracked repository (o remote repository) che è possibile collegare a ogni repository Git tramite il comando git remote.
Il comando git remote in git, nella realtà, non si occupa di effettuare l’effettivo acceso o sync a tali repository remoti, ma gestisce quelli che potremmo definire dei segnalibri alle URL di tali repository.
$ git remote -v origin https://github.com/developer/project-fork.git (fetch) origin https://github.com/developer/project-fork.git (push) upstream https://github.com/company/project.git (fetch) upstream https://github.com/company/project.git (push)
Tali segnalibri possono avere qualsiasi nome, ma per convenzione remote indicato con il nome origin è quello “originale”. Da notare che quando si crea un nuovo repository locale tramite il comando git clone, viene automaticamente creato il remote origin che punta al repository da cui si è effettuato il clone.
Ci sono diversi sotto-comandi che è possibile usare per gestire i tracked repository:
$ git remote origin $ git remote add john http://dev.example.com/john.git $ git remote -v origin http://dev.example.com/john.git (fetch) origin http://dev.example.com/john.git (push) john http://dev.example.com/john.git (fetch) john http://dev.example.com/john.git (push) $ git remote rename john same-origin $ git remote -v origin http://dev.example.com/john.git (fetch) origin http://dev.example.com/john.git (push) same-origin http://dev.example.com/john.git (fetch) same-origin http://dev.example.com/john.git (push) $ git remote rm same-origin