I have searched in google, they say "git ls-remote git-url" can say whether git repo exists or not.
But i have a problem when use this command to check github unexisting https git url.
for example, when I run below command, it will require input username and password.
$ git ls-remote https://github.com/grant/noexisted.git
I only want to check whether the repo exists or not, and I call "git ls-remote" command in ruby code, so how to skip this auto shell prompt?
Why not just make an HTTP request, and look for a 404?
For example, you can use the
wget
command-line utility:This prints 8, while
this prints 0 (success).
I'm not familiar with Ruby, but I'm sure it would be trivial to make the HTTP request and check for a 404 (not found) or 200 (success).