I have a git repository on the server. There are several Jobs that make git pull from BitBucket into that repository. Now my problem is that if several jobs will run at the same time it gives an error that the git process is already running and the job is failing. Is there a way to set a flag(I mean git pull -[flag] origin master) that will wait until the process finishes or at least skip git pull and don't trigger error
CodePudding user response:
Try wrapping the pull in a script that attempts and waits for a second (or so) if there is a failure... it should eventually work, right?
while true; do
if git pull blahblah; then break; fi
sleep 1
done