dominique120
dominique120

Reputation: 1302

How to check if GIT has fully cloned a repository?

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

Answers (2)

ArunRaj
ArunRaj

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

Noufal Ibrahim
Noufal Ibrahim

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

Related Questions