Given an SSH URL such as git@github.com:<user>/<project>.git
, how could I test if a particular repository exists on github (assuming I also have the proper SSH keys set up)?
Using git clone
is undesirable, because if it does exist, it will immediately proceed to download it. I don't see any flags that can be passed to git clone
, that will simply check the repository's existence without downloading.
I suppose I could parse the URL and use the public API instead, by running a command such as this:
curl "https://api.github.com/repos/<user>/<project>"
but that gives back a lot of extraneous information instead of a simple yes/no.
Is there a better solution to simply checking if a repository exists?