On Wed, 25 May 2016 07:52:10 -0700 (PDT)
Sandor Hadas <sandorhadas...@gmail.com> wrote:
> I have a shell script what does a "git clone" and then some
> operations on the repo cloned. It works fine when run from the
> command line.
> However, if the very same script is added to cron then what happens:
> 1. Cron starts the script
> 2. Script invokes git clone
> 3. git clone spawns several "git-remote-https" processes
> 4. git returns while the spawned processes run
> 5. Commands based on the repo fail (if I add a sleep 30 before
> running the commands then success, but that cannot be the right path)
> How do I make sure that a git clone is actually complete when running
> from cron OR how do I make git run synchronously so that it does not
> return control to the bash before it is really done (nohup did not
> work because of the detached spawns)?
If  is your question repeated on SO (with much more useful details),
then the problem is that you're using '&' after `git clone` while
supposedly you should have used '&&'.
If you indeed wanted -- for some unknown reason -- to actually
background the `git clone` process, then you have to call `wait` later
in the script to wait for the child processes to finish.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.