4

I'm trying to add a remote server from my git bash prompt with something like:

git remote add origin ssh://myserver.pair.com/usr/home/myname/myrepo.git

fatal: Not a git repository (or any of the parent directories): .git

I seem to have ssh set up ok because this...

ssh myserver.pair.com

... logs in just fine without prompting me for my password.

What appears to happen with the remote add is that it doesn't even try to contact the server. It returns with an error instantly, and it doesn't appear to matter what I put for a server name:

git remote add origin ssh://blahblahblah/usr/home/myname/myrepo.git

fatal: Not a git repository (or any of the parent directories): .git

Have I misconfigured git somehow?

Technical details: Windows Vista, MsysGit v1.6.4, SSH configured with the file C:\Program Files\Git\etc\ssh\ssh_config

1 Answer 1

16

fatal: Not a git repository (or any of the parent directories): .git

This tells you that the directory you're in is not a git repository. Before you can add remote servers, commit things and so you must have a git repository created.

In a git repository there's a directory (which can be hidden) named .git. It contains metadata on the repository and all the data regarding the checked files.

To create it type git init in the directory you wish to have a git repository. Then you could add remote servers and perform operations on it.

2
  • 1
    Thanks :) I actually solved this with a git clone first. +1
    – izb
    Nov 16, 2009 at 12:07
  • This error happened to me even though I'd git init. Also solved with git clone Dec 27, 2019 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .