Git commit over SSH not recognizing remote repository

Posted on

Problem :

I have 2 machines, client and server. I want to send git repositories from client to server, using remote push.
I’ve run these commands in this order on the server:

mkdir /mnt && cd /mnt
mkdir test.git && cd test.git
sudo git init --bare

I’ve run these commands on the client:

mkdir /mnt && cd /mnt
mkdir test.git && cd test.git
sudo git init
sudo git remote add testy ssh://user@server/mnt/test.git
sudo vim testing.txt
sudo git add testing.txt
sudo git commit -m "testing"
sudo git push testy master

This produces the error on the client machine:
fatal: '/mnt/test.git' does not appear to be a git repository. fatal: The remote end hung up unexpectedly.

There are several similar questions, but none of them address my problem. I’ve tried their solutions verbatim without success. This isn’t a duplicate, because those answers do not solve the issue.
Any suggestions to fix these problems?

Solution :

I would guess user@server does not have read/write/execute access to /mnt/test.git:

$ sudo sh -c 'cd $(mktemp -d) && git init --bare'
Initialized empty Git repository in /tmp/tmp.TNLcXTZQcN/
$ cd $(mktemp -d)
$ git remote add /tmp/tmp.TNLcXTZQcN
fatal: Not a git repository (or any parent up to mount point /tmp)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Leave a Reply

Your email address will not be published. Required fields are marked *