# testing for cloned repository

2 messages from 2006-07-27 to 2006-07-27. Participants: Robert White, Johannes Schindelin.
Thread: https://gitlist.dev/t/5012

## Robert White, 2006-07-27 13:46

Subject: testing for cloned repository
Message-ID: <0AC9E5E7-52CC-4715-BB26-622A2177308B@mac.com>
URL: https://gitlist.dev/e/0AC9E5E7-52CC-4715-BB26-622A2177308B%40mac.com

```
I am using:
if [ -f ".git/remotes/origin" ]; then
	# this repository is a clone
fi
in a bash script to test if a repository was cloned and then do  
appropriate pulls and pushes which fit my situation.
Is this the proper way to test this or should I be using something  
different?

Thanks in advance for your help and for providing git.  I have been  
using it on my Linux and MacOSX machines without any problems.

Bob White

```

## Johannes Schindelin, 2006-07-27 14:10

Subject: Re: testing for cloned repository
Message-ID: <Pine.LNX.4.63.0607271608260.29667@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0607271608260.29667%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <0AC9E5E7-52CC-4715-BB26-622A2177308B@mac.com>

```
Hi,

On Thu, 27 Jul 2006, Robert White wrote:

> if [ -f ".git/remotes/origin" ]; then
> 	# this repository is a clone
> fi
> in a bash script to test if a repository was cloned and then do appropriate
> pulls and pushes which fit my situation.

I think it would be better to do this:

-- snip --
. git-parse-remote
test "$(get_remote_url origin)" != origin && echo "is cloned"
-- snap --

There are 3 different ways to store remote information ATM, and this 
method gets them all (even if, at a certain distant time in the future, 
the default should be changed).

Hth,
Dscho

```
