I've got an automated script that parses a server and clones all the repos in one of its folders. The pseudocode of what it does is:
for each repo_name
if a folder named like repo_name exists in .
cd repo_name
git fetch origin
else
git clone repo_url
end
end
These repos are, in occasions, empty repositories. Then the git clone command fails - or the script I use thinks it fails. It prints a message on stderror (I think) saying
You appear to have cloned an empty repository
Well, thank you, git, but that was no error.
I tried adding the --quiet
option to the command, but that message keeps appearing.
Is there a way to supress it, without supressing the rest of possible errors?
Not very elegant, but how about redirecting stderr
to stdout
and filtering that error with grep
?
git clone repo_url 2>&1 | grep -v 'warning: You appear to have cloned an empty repository.'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With