error de git: no se pudo enviar algunas referencias a


Por alguna razón, no puedo presionar ahora, mientras que podría hacerlo ayer. Tal vez metí la pata con las configuraciones o algo así.

Esto es lo que sucede:

Cuando uso el git push origin master

gitbashscr

Cómo se ve mi directorio de trabajo y mi repositorio remoto:

introduzca la descripción de la imagen aquí

 194
Author: Tshepang, 2014-06-09

17 answers

Si el repositorio de GitHub ha visto nuevas confirmaciones enviadas a él, mientras trabajabas localmente, te aconsejaría usar:

git pull --rebase
git push

La sintaxis completa es:

git pull --rebase origin master
git push origin master

De esa manera, volverías a reproducir (la parte --rebase) tus commits locales encima de la origin/master recién actualizada (o origin/yourBranch: git pull origin yourBranch).

Ver un ejemplo más completo en el capítulo 6 Pull with rebasedel Git Pocket Book.

Yo recomendaría a:

git push -u origin master

Que establecería una seguimiento de la relación entre su rama master local y su rama upstream.
Después de eso, cualquier empuje futuro para esa rama se puede hacer con un simple:

git push

Ver " ¿Por qué necesito empujar explícitamente una nueva rama?".


Dado que el OP ya restablece y rehace su confirmación encima de origin/master:

git reset --mixed origin/master
git add .
git commit -m "This is a new commit for what I originally planned to be amended"
git push origin master

No hay necesidad de pull --rebase.

Nota: git reset --mixed origin/master también se puede escribir git reset origin/master, ya que la opción --mixed es la predeterminada cuando se usa git reset.

 303
Author: VonC,
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-03 14:54:00

¿Alguien intentó:

git push -f origin master

Eso debería resolver el problema.

EDIT: Basado en el comentario de @Mehdi a continuación necesito aclarar algo sobre —force pushing. El comando git anterior funciona de forma segura solo para la primera confirmación. Si ya había confirmaciones, solicitudes de extracción o ramas en anteriores, esto restablece todo y lo establece desde cero. Si es así, consulte la respuesta detallada de @VonC para una mejor solución.

 42
Author: CagCak,
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-01-19 17:26:56

Si acaba de usar git init y ha agregado sus archivos con git add . o algo similar y ha agregado su rama remota, puede ser que simplemente no haya enviado (git commit -m 'commit message') nada localmente para enviar al remoto... Acabo de tener este error y ese fue mi problema.

 24
Author: ironcladmvtm,
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-05-22 18:57:27

Yo tenía el mismo problema. Estaba teniendo este problema porque no había hecho ningún commit ni siquiera commit inicial y todavía estaba tratando de empujar.

Una vez lo hice git commit -m "your msg" y luego todo funcionó bien.

 11
Author: ppmakeitcount,
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-01-04 13:16:04

Encuentro la solución a este problema en la ayuda de github.

Se puede ver desde: Tratando con errores no de avance rápido

Dice:

Puede solucionar esto obteniendo y fusionando los cambios realizados en la rama remota con los cambios que ha realizado localmente:

$ git fetch origin
# Fetches updates made to an online repository
$ git merge origin branch
# Merges updates made online with your local work

O, simplemente puedes usar git pull para realizar ambos comandos a la vez:

$ git pull origin branch
# Grabs online updates and merges them with your local work
 10
Author: Sealter,
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-11-21 06:28:16

Si está usando gerrit, esto podría ser causado por un id de cambio inapropiado en la confirmación. Intente eliminar el Id de cambio y vea qué sucede.

 4
Author: Jim Sime,
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-07-05 09:22:21

Cambie el nombre de su rama y luego empuje, por ejemplo:

git branch -m new-name
git push -u new-name

Esto funcionó para mí.

 4
Author: p8ul,
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-02-01 05:53:34

Recuerda confirmar tus cambios antes de enviarlos al repositorio de Github. Esto podría solucionar tu problema.

 2
Author: Alf Moh,
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-12-13 18:13:46

Antes de push tienes que añadir y confirmar los cambios o hacer git push -f origin master

 2
Author: Kinnera Reddy,
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-14 15:15:41

No confirmar los cambios iniciales antes de empujar también causa el problema

 2
Author: Claw,
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-05-06 07:26:06

No estoy seguro de si esto se aplica, pero la solución para mí era confirmar algo localmente después de git init. Luego empujé a remoto usando set set-upstream ...

 1
Author: user1889992,
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-17 17:33:37

1) git init

2) git remote add origin https://gitlab.com/crew-chief-systems/bot

3) git remote-v (para comprobar el repositorio actual)

4) git add-A (añadir todos los archivos)

5) git commit-m 'Added my project'

6) git pull master rebase origin master

7) git push origin master

 1
Author: James Siva,
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-09-11 04:25:03

Bueno, si ninguna de las respuestas anteriores están funcionando y si has estropeado algo con ssh-add últimamente. Try

ssh-add -D
 0
Author: Abhisek,
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-04-03 17:25:38

En mi caso, este error ocurrió porque había algo de mantenimiento sucediendo en nuestra versión de GitLab.

 0
Author: GreenGiant,
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-06-21 16:47:19

También puedes arreglarlo editando el archivo de configuración de git de tu proyecto:

¿Dónde está?

.git / config

Agregue las siguientes líneas al final si no lo son.

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

Esto resolvió mi problema

 0
Author: Edd,
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-23 05:46:40

En mi caso el cierre del editor (visual studio code) resolvió un problema.

 0
Author: Vasyl Gutnyk,
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-01-24 12:01:45

Error de Git: error al enviar algunas referencias también se produce cuando el nombre del repositorio local coincide con el nombre del repositorio remoto correspondiente. Asegúrese de que está trabajando en el par correcto de repositorios antes de extraer los cambios al repositorio remoto. En caso de que se escribe incorrectamente y desea eliminar el repositorio local, use los siguientes pasos

Eliminar el repositorio local de windows 1. del / F / S / Q / A .git 2. rmdir .git 3. Corrija el nombre de la carpeta local (XXXX02 - > XXXX20) o si es un repo recién creado elimínelo y vuelva a crear el repo (nombre del Repo XXXX02 cambiado a XXXX20). 4. git init 5. Reasignar con repo remoto si no está mapeado. 6. git remote add origin https://github.com/ / XXXX20. git 7. git push-u origin master

 0
Author: Sunil Vishnu Raskar,
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-16 02:27:44