# Git - check file exist on online repository

## Fulgurance

Hello, can you know with git cli how to check if file exist on git online repository ? (public repository)

----------

## ct85711

You may want to look at this:

https://stackoverflow.com/questions/4135049/how-do-i-check-if-a-file-exists-in-a-remote

----------

## richardfullers

function validate_url(){

  if [[ `wget -S --spider $1  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi

}

----------

## P.Kosunen

 *richardfullers wrote:*   

> function validate_url(){
> 
>   if [[ `wget -S --spider $1  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
> 
> }

 

Useless use of grep.

```
wget -q -O /dev/null https://[RAW-FILE-URL] && echo "Success"
```

```
wget -q -O /dev/null https://[RAW-FILE-URL] || echo "Failed"
```

----------

