maestro rechazado - > maestro (no avance rápido)


Estoy tratando de enviar mi proyecto (todos los archivos en un nuevo repositorio). Sigo los pasos pero cuando presiono con git push -u origin master obtengo este error:

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:asantoya/projectnewbies.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.

Realmente muchas veces tengo este error y no puedo averiguar qué hacer.

 152
Author: pmr, 2012-07-28

17 answers

Como dice el mensaje de error: git pull antes de intentar git push. Al parecer, su rama local no está sincronizada con su rama de seguimiento.

Dependiendo de las reglas del proyecto y su flujo de trabajo, también puede usar git pull --rebase.

 121
Author: pmr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-18 17:51:59

Prueba esto: git push -f origin master

 96
Author: a_shahmatov,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-04 12:59:15

Acabo de recibir este error.

Creé un repositorio github después de crear mi repositorio git local, así que necesitaba aceptar los cambios en local antes de enviar a github. En este caso, el único cambio fue el archivo readme creado como paso opcional al crear el repositorio github.

git pull https://github.com/*username*/*repository*.git master

La URL del repositorio se obtiene desde aquí en la página del proyecto github:

introduzca la descripción de la imagen aquí

Luego reinicialicé (esto puede no ser necesario)

git init
git add .
git commit -m "update"

Luego presione:

git push
 10
Author: blue-sky,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-13 23:52:45

Había creado un nuevo repositorio en github y tenía el mismo problema, pero también tenía problemas mientras tiraba, así que esto funcionó para mí.

Pero esto no se aconseja en los repositorios que ya tienen muchos códigos como este podría estropear todo

git push origin master --force
 6
Author: Muneef M,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-07 11:21:57

ADVERTENCIA:

Ir por un 'git pull' no SIEMPRE es una solución. Puede enfrentar este problema (el que se menciona en la Q) si ha cambiado intencionalmente el historial de su repositorio. En ese caso, git está confundiendo los cambios en tu historial con nuevos cambios en tu repositorio remoto. Por lo tanto, usted debe ir para un git push --force, porque llamando git pull deshará todos los cambios que hizo a su historial, intencionalmente.

 5
Author: hsalimi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-18 11:04:31

! [rechazado] master - > master (non-fast-forward)

No se asuste, esto es extremadamente fácil de arreglar. Todo lo que tiene que hacer es emitir un pull y su rama será de avance rápido:

$ git pull myrepo master

Luego vuelve a intentar tu push y todo estará bien:

$ git push github master

 4
Author: user3292712,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-10 11:52:09

Prueba este comando:"git pull origin master"

Funcionó para mí.

Compruebe este enlace: https://help.github.com/articles/dealing-with-non-fast-forward-errors

 4
Author: firefly28,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-25 15:10:49

Si git pull no ayuda, entonces probablemente haya empujado sus cambios (A) y después de eso haya utilizado git commit --amend para agregar algunos cambios más (B). Por lo tanto, git piensa que puedes perder el historial-interpreta B como un commit diferente a pesar de que contiene todos los cambios de A.

             B
            /
        ---X---A

Si nadie cambia el repositorio después de A, entonces puedes hacer git push --force.

Sin Embargo, si hay cambios después de A de otra persona:

             B
            /
        ---X---A---C

Entonces usted debe rebase que las personas cambian de A a B (C->D).

             B---D
            /
        ---X---A---C

O solucione el problema manualmente. No pensé cómo hacer eso todavía.

 4
Author: Alexander Volkov,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-30 09:05:07

Use este comando:

git pull --allow-unrelated-histories <nick name of repository> <branch name>

Como:

git pull --allow-unrelated-histories origin master

Este error ocurre cuando los proyectos no tienen ningún ancestro común.

 4
Author: Umar Farooq,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-16 15:12:24

Necesitas hacer

git branch

Si la salida es algo así como:

* (no branch)
master

Entonces haga

git checkout master

Asegúrese de que no tiene ninguna confirmación pendiente, ya que la comprobación perderá todos los cambios no confirmados.

 3
Author: cage,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-04 15:11:36

Tuve este problema en una máquina de desarrollo. La rama dev estaba empujando bien, pero la la master rama me dio (mientras git pushing al estar en la dev rama):

! [rejected]        master -> master (non-fast-forward)

Así que lo intenté:

git checkout master
git pull

Que me dio:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either.

Descubrí que faltaba la rama maestra de .git/config y agregué:

[branch "master"]
    remote = origin
    merge = refs/heads/master

Después git push también funcionó bien en la rama dev.

 2
Author: guaka,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-09-03 13:10:07

Esto me sucedió cuando estaba en la rama develop y mi rama master no está con la última actualización.

Así que cuando traté de git push desde la rama develop tuve ese error.

Lo arreglé cambiando a rama maestra, git pull, luego regresé a desarrollar rama y git push.

$ git fetch && git checkout master
$ git pull
$ git fetch && git checkout develop
$ git push
 2
Author: Jonn Marc Vistal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-17 18:17:21

Esto se debe a que hizo algunos cambios en su maestro para que el proyecto le pida que tire primero. Si quieres empujarlo de todos modos, puedes usar la fuerza bruta escribiendo esto:

git push -f origin master

Recuerde primero confirmar sus cambios:

git add .
git commit -m "Your commit message"
 1
Author: Guim Gonzalez,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-20 16:55:09

Lo único que pude resolver este problema fue eliminar el repositorio local y git y crear el mismo de nuevo en ambos extremos. Funciona bien por ahora.

 0
Author: Akash Kumar Sharma,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-26 04:27:39

Tuve lo mismo que issue. Yo uso Git Totoise. Simplemente Haga Clic Derecho ->TotoiseGit -> Limpiar . Ahora puedes empujar a Github Funcionó bien conmigo: D

 0
Author: Son Nguyen Thanh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-12-22 12:39:26

Esto se debe a que ha realizado cambios conflictivos en su maestro. Y su servidor de repositorio no es capaz de decirle que con estas palabras, por lo que da este error porque no es una cuestión de él tratar con estos conflictos para usted, por lo que le pide que lo haga por sí mismo. ¿Cómo ?

1- git pull Esto fusionará el código de su repositorio con el código de su maestro de sitio. Así se muestran los conflictos.

2 - tratar estos conflictos manualmente.

3-

git push origin master

Y presto, su problema ha sido resuelto.

 0
Author: Paulo Linhares - Packapps,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-04 19:51:46

Este comando funcionó bien para mí

git push -f origin master
 0
Author: raed,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-18 12:15:52