开发者

Where is my git repository after pushing through an ssh tunnel?

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:12开发者_如何学编程34/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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜