Perche piu remote
I workflow reali spesso coinvolgono piu di un remote: un origin per il proprio fork, un upstream per il repo canonico, piu mirror, target di deploy, e fork per ambiente.
Aggiungere remote
git remote add origin [email protected]:you/fork.git
git remote add upstream https://github.com/org/repo.git
git remote add deploy [email protected]:app.git
git remote -v
Fetch da tutti
git fetch --all --prune
git remote update --prune
git fetch upstream main:main
Tracciare la cosa giusta
git branch --set-upstream-to=origin/main main
git push -u origin feature
git config branch.feature.remote origin
git config branch.feature.merge refs/heads/feature
URL diversi per push e pull
git remote set-url --push origin [email protected]:you/fork.git
git remote set-url origin https://github.com/you/fork.git
Mirroring
git remote add mirror --mirror=push [email protected]:org/repo.git
git push mirror
Workflow triangolare
git config remote.pushDefault origin
git config push.default current
Credenziali per remote
[credential "https://github.com"]
helper = osxkeychain
[credential "https://gitlab.example.com"]
helper = !pass-git-helper
Errori comuni
Pushare verso upstream per errore quando si intendeva origin; impostare remote.pushDefault.