2

I work on a private network with a git repository hosted there at git.mycompany.com.

I have a remote server without access to this private network, I access it via ssh. To get my code to the server, I was recommended to use scp. This isn't ideal.

I am trying to use ssh forwarding to allow me to use commands like git clone on this server like

ssh -L 9418:git.mycompany.com:9418 [email protected]

Then use git clone like

git clone my.name@localhost:my_project/my_project.git

after creating and adding an ssh key to my git server as I usually would. But git asks me for a password, and entering my password does not work, so I assume something in my method is incorrect.

Permission denied, please try again.

I can't tell if the authorization is not working, or my traffic forwarding is wrong.

1
  • Why do you forward port 9418? With the syntax you showed, git uses SSH, on port 22. Commented Dec 25, 2016 at 9:21

1 Answer 1

1

If you have ssh already working, you can simply clone through it with:

git clone ssh://server/path/to/repository.git 

There is no need to manually set up a ssh tunnel. The reverse can be done with a push. Create an empty repository on the remote server:

cd /path/ git init --bare remote.git 

then push to it from your repository:

git push ssh://server/path/remote.git 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.