Reputation: 1302
How can I check if git has successfully cloned a repository, and based on that result, execute commands inside the bash script?
I was trying some combinations of grep
checking the output of git status
but I've only managed to confuse myself more.
I'm ruining timeout 60s git clone ...
so I must make sure the repository has cloned fully, and if it has not to skip whatever it would have done with the cloned data.
Upvotes: 3
Views: 10037
Reputation: 1790
Have a look at it.
I think You are expecting this code.
https://stackoverflow.com/a/13715406/2959196
Also Have a look at the conversation. It might help you better.
How to detect if a git clone failed in a bash script
Upvotes: 3
Reputation: 72745
Your timeout command will return a non zero exit code if it terminates the program. Use that rather than checking the repository to see if it's cloned.
Upvotes: 0