# git-push error handling

2 messages from 2012-06-20 to 2012-06-21. Participants: Neal Kreitzinger, Jeff King.
Thread: https://gitlist.dev/t/30853

## Neal Kreitzinger, 2012-06-20 19:43

Subject: git-push error handling
Message-ID: <jrt949$o3g$1@dough.gmane.org>
URL: https://gitlist.dev/e/jrt949%24o3g%241%40dough.gmane.org

```
Does git push always return an error to "if [ $? -ne 0 ]" when the push 
fails?  Is this sufficient to verify your git-push worked?  I'm being 
asked to advise on commands to 'verify the canonical repo is in good 
working order' immediately before a push and immediately after a push 
(for total automation).  I'm used to doing pushes manually.  I think 
git-push itself will tell you if there's a problem, and there's no need 
for 'before' and 'after' checks.  Correct?

Very Limited Scope of Context:
We don't do anything special in the push.  We are just fast-forwarding 
the master branch and there is only one branch (master).  (The 
powers-that-be are doing their own change control (ie, file locking) and 
only care to copy files to the worktree of master, git-add, git-commit, 
and git-push to canonical.)  They have created a change control menu 
that only uses git to 'check out' source and to 'commit source' 
automatically via scripts.  They are doing the merges manually and not 
using git for that so there is no 'merging of master' going on as far as 
git is concerned.  They're basically using git to replace cvs in their 
legacy change control so they don't wish to use any git functionality 
like branches, merges, etc, at this time.  I think they are just using 
git checkout, git add, git commit, to say they have put the changes into 
a 'change control repository'.

v/r,
neal

```

## Jeff King, 2012-06-21 06:07

Subject: Re: git-push error handling
Message-ID: <20120621060724.GA19485@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120621060724.GA19485%40sigill.intra.peff.net
In-Reply-To: <jrt949$o3g$1@dough.gmane.org>

```
On Wed, Jun 20, 2012 at 02:43:04PM -0500, Neal Kreitzinger wrote:

> Does git push always return an error to "if [ $? -ne 0 ]" when the
> push fails?  Is this sufficient to verify your git-push worked?

It should (and if it doesn't, it's a bug). But do note that even a
failed push may have been partially successful (e.g., pushed some refs
but failed on others).

-Peff

```
