Having to perform bit operations on flags is very unintuitive. The command line git client fails when push fails.
I have the same issue. An exception should be raised instead.
Error lines received while fetching: error: failed to push some refs to '[email protected]:NicoHood/project.git'
hint: Updates were rejected because the tag already exists in the remote.
This might be related to a change in the git program itself, as I believe git push should return with a none-zero exit status if it fails. Apparently this doesn't happen under certain circumstances _(anymore)_.
Is problem that it's eating the exception here
https://github.com/gitpython-developers/GitPython/blob/master/git/remote.py#L702
Should always raise an exception, warning text also references fetch instead of push.
Is this still an issue? The links provided don't refer to a specific commit, thus the lines shift and make it hard to find the point you refer to, in retrospective. Thank you.
@Byron i think @David-Green was referring to this https://github.com/gitpython-developers/GitPython/blob/2b3c16c39953e7a6f55379403ca5d204dcbdb1e7/git/remote.py#L702
This has also been an issue for me using 2.1.5:
When doing :
self.repo = Repo('repo_dir')
self.repo.remotes[0].push(self.repo.head.reference.name)
Get this logging:
(remote.py:702) WARNING > Error lines received while fetching: error: failed to push some refs to 'ssh://xxxxxxx' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.
But in fact I want this to be an exception. It does look like the following lines that are the problem (at line 730 in the current master:
except Exception:
if not output:
raise
elif stderr_text:
log.warning("Error lines received while fetching: %s", stderr_text)
return output
Sorry to pile on, but this just bit my team today too. We were moving a few hundred repos, and a few of them failed to push with mirror to the new remote, yet the script exited successfully with no errors but never actually pushed the repo. Trying to push with command line gives us "error: failed to push some refs to..."
I got bitten by this too while trying to automate git push.
2018-04-30 11:12:37,693 WARNING git.remote Error lines received while fetching: error: failed to push some refs to 'git@xxxxxx:yyyyyy/zzzzz.git'
Do you think fixing this would be possible for one of the people having been bitten by this?
The code to alter should be right here.
Probably changing the behaviour from logging to throwing an exception would be desirable, even though it technically is a breaking change.
Also been bitten by this recently...reviving!
I have had to use some very serious checking to detect and handle failed pushes with gitpython==2.1.11 and it's bonkers that I had to try so hard.
Agree. Errors should be reported as exceptions.
Also was just bit by this issue.
Also was just bit by this issue.
As a general question: What about submitting a PR with a new push_or_throw(…) method, which does as it says? There should be enough references in this thread to implement it without spending too much time on research.
Most helpful comment
I have the same issue. An exception should be raised instead.