# [Bug] Misleading error message when run in a non-Git directory

2 messages from 2020-04-23 to 2020-04-23. Participants: Victor Porton, brian m. carlson.
Thread: https://gitlist.dev/t/53303

## Victor Porton, 2020-04-23 22:42

Subject: [Bug] Misleading error message when run in a non-Git directory
Message-ID: <c0e916fb-7b0e-1192-e71d-ea6449863e9b@narod.ru>
URL: https://gitlist.dev/e/c0e916fb-7b0e-1192-e71d-ea6449863e9b%40narod.ru

```
git remote add origin ...

produces the error

fatal: remote origin already exists.

when run in the directory which is not initialized by Git (has no .git
folder).

This error message is misleading.

git --version
git version 2.20.1


```

## brian m. carlson, 2020-04-23 23:26

Subject: Re: [Bug] Misleading error message when run in a non-Git directory
Message-ID: <20200423232622.GK6465@camp.crustytoothpaste.net>
URL: https://gitlist.dev/e/20200423232622.GK6465%40camp.crustytoothpaste.net
In-Reply-To: <c0e916fb-7b0e-1192-e71d-ea6449863e9b@narod.ru>

```
On 2020-04-23 at 22:42:25, Victor Porton wrote:
> git remote add origin ...
> 
> produces the error
> 
> fatal: remote origin already exists.
> 
> when run in the directory which is not initialized by Git (has no .git
> folder).
> 
> This error message is misleading.

I don't see this, using a reasonably up-to-date version of next.  What I
see is the following:

  $ git remote add origin foo
  fatal: not a git repository (or any of the parent directories): .git

Are you running this in a directory under your home directory?  If so,
is your home directory a repository?

If not, can you tell us what running "git rev-parse --show-toplevel" in
that directory prints?
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

```
