tags:

views:

49

answers:

2

I've set my router at home to do port forwarding via SSH. I've succesfully cloned git repositories via:

git clone git+ssh://user@localhost:1234/repos local_repos

and then working locally, I can push and pull without trouble.

Now I'm in the situation where I created a project locally and I want to put it on my home machine. This is what I tried. On the home machine:

cd && mkdir new-project && mkdir new-project/.git
cd !$ && git --bare init

On the local machine:

mkdir new-project && cd new-project
git init
... (add, commit etc.)
git remote add origin origin git+ssh:/user@localhost:1234/home/user/new-project
git push origin master --tags

After giving my credentials, it seems to work happily. But if look on the home machine, I see nothing. A git status in /home/user/new-project yields an error.

Question: Where did my stuff get pushed too? (Or, what got pushed?)
Secondly: How can I achieve this when my tunnel is 'one way' so to speak?

A: 

If the error is "fatal: This operation must be run in a work tree", that's normal for bare repositories. A better test would be to try cloning the repository.

bemace
There's no error. According to the client side, the push works. When I log in to the server I see nothing.
Jamie
you said git status yields an error. And it's normal to see nothing in a bare repo, depending on your definition of 'nothing'. Have you tried cloning from it?
bemace
I misunderstood; hind sight allows me to map your thought process correctly. I didn't know what a bare repository was. And yes, if I clone from it does work. Thanks for the tip.
Jamie
A: 

You are working with a bare repository. You have to cd .git ; git status to see the status. See git ready for some related discussion.

J-16 SDiZ
Thanks for the link, that explained it perfectly. But as an aside, `cd .git ; git status`, as the error message implies only works in a work tree.
Jamie