Git Push Authentication#
What Was Established#
Patterns for resolving Git push authentication issues and handling divergent branches when working across multiple machines.
Key Decisions#
- Multi-machine workflow: Always
git pull before starting work; commit and push when done.
- Divergent branch resolution: When local and remote have diverged, use
git pull --no-rebase (merge) for safety or git fetch origin && git reset --hard origin/main to discard local commits for remote-only state.
Resolving Divergent Branches#
Symptom#
hint: You have divergent branches and need to specify how to reconcile them.
fatal: Need to specify how to reconcile divergent branches.
Option 1: Merge (preserves both histories)#
git pull --no-rebase
# Or set as default:
git config pull.rebase false
Option 2: Rebase (local commits on top of remote)#
git pull --rebase
# Or set as default:
git config pull.rebase true
Option 3: Discard local, use remote only#
git fetch origin
git reset --hard origin/main
Option 4: Fast-forward only (fails if diverged)#
Multi-Machine Workflow#
When working from multiple machines on the same repo: