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 pullbefore starting work; commit and push when done. - Divergent branch resolution: When local and remote have diverged, use
git pull --no-rebase(merge) for safety orgit fetch origin && git reset --hard origin/mainto 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 falseOption 2: Rebase (local commits on top of remote)#
git pull --rebase
# Or set as default:
git config pull.rebase trueOption 3: Discard local, use remote only#
git fetch origin
git reset --hard origin/mainOption 4: Fast-forward only (fails if diverged)#
git pull --ff-onlyMulti-Machine Workflow#
When working from multiple machines on the same repo: