Entendiendo git: connect branch a un repositorio remoto
Tengo un repositorio en github, digamos testrepo. Ahora me gustaría configurar un repositorio localrepo
que tiene una ramaorigin-master
Donde quiero ser capaz de editar cosas desde el repositorio.
repo/origin-master <--------> origin/master
La clonación funciona bien:
mkdir repo && cd repo && git init
# not necessary of course:
echo "master" > master && git add master && git ci -m "master"
git remote add origin [email protected]:<username>/testrepo.git
git fetch origin
git branch --set-upstream origin-master origin/master
git checkout origin-master
# create a new file:
echo "for origin-master" > orig-master && git add orig-master && git ci -m "orig-master"
pero
git push origin
To [email protected]:<username>/testrepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:<username>/testrepo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
¿Cómo puedo decirle a git que si quiero enviar a origen, quiero impulsar a la sucursal local?origin-master
aorigin/master
?