Score:0

How can I stop and rerun git clone command in case of a specified time delay?

cn flag

I have a custom clone command. I call clone org_name and it automatically clones every repository of that organization for which the current developer has access to.

Of course my clone command uses GitHub API and then loops over the repos to create git clone commands.

However, sometimes the git clone [email protected]:Org/Repo hangs. And it fails with timeout error:

ssh: connect to host github.com port 22: Connection timed out

This is related to either my Internet or the GitHub servers. But both of them are not in my hands and under my control.

I want to run the git clone [email protected]:Org/Repo and wait for like 3 seconds and in case it did not get an answer, I want to reissue this command.

Howe can I do that?

hr flag
You could possibly use the `timeout` command in a loop - something like the answer here [Bash wait for a ping success](https://askubuntu.com/a/929711/178692)
waltinator avatar
it flag
Check the status (`$?`) of `git clone ...`, in a loop.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.