I use a Git hosting. So I often run git push.

I want to run git push in background, in order that me not to wait when it finishes but do other tasks in my terminal.

But I don't want to run git push in real background (git push &) because I need to see its output to be sure that it run without an error.

What is the proper way to run it like a background process but seeing its output nevertheless?

The best thing I conveived is:

xterm -hold -e 'git push' &

But this uses XTerm instead of Gnome Terminal, the application I use the most. This is somehow inconsistent.

What are other alternatives?

  • 1
    I don't have the manual handy but check out zenity Feb 8, 2016 at 22:54
  • 2
    my best suggestion is something like screen or tmux where you could open a separate virtual window to kick off the git push, keeping your other (virtual) windows uncluttered, yet keeping the git output available.
    – Jeff Schaller
    Feb 9, 2016 at 0:49

2 Answers 2


If you don't need to see the output in real time, you can do something like:

git push 2>&1 > ~/git-push-$(date +"%Y%m%d-%H%M").log &

The above will create a file in your home directory with the date and time you invoked it in its filename (e. g. git-push-20160208-1201.log). You can put this into an alias or shell function so that you don't have to retype, or if you only need to preserve the last push for review, you can just use:

git push 2>&1 > ~/git-push.log &

You can even get really fancy and send yourself a notification if the push fails, with either command:

git push 2>&1 > ~/git-push.log || notify-send "Push failed" "git push initiated from $(pwd) at $(date) threw an error!" &
git push 2>&1 &

"2>&1" redirects all output to stdout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.