When a new bare git repo says “does not appear to be a git repo”

If you ever just created a bare git repository to act as a server-side only repo, and then immediately attempt to push a new local repo up to sync the initial version, and you get an error, it is probably caused by the fact that the path specified is a relative path.  if using ssh:// as the protocol, the path must be absolute.

For example:

On the server, you typed:

mkdir NewRepo
cd NewRepo
git --bare init

And on the client you typed:

mkdir NewRepo
cd NewRepo
git init 
git add .
git commit -m "Initial Revision"
git remote add central ssh://username@myreposerver.com/NewRepo
git push --set-upstream central master
git push

And as a result you get this error:

fatal: '/NewRepo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights 
and the repository exists.

This is caused by not specifying the full path like this:

remote add central ssh://username@myreposerver.com/usr/home/NewRepo


Leave a Reply