0

I'm working on a basic project under an aws network. The project use a tipical vpn with a public subnet with an elb that forward traffic to a private subnet where the code resides.

I used to work on the private subnet with a tunnel launched throught putty and then passing files with filezilla. The process works fine.

Now, I want to go a step further and start using git as version controller of my project, I set up an initial repository and a bare repository inside the private subnet.

Then in my local desktop I have to clone the bare repository and start working on the project and push changes to the remote one.

With my tunnel on, I try with:

git clone ssh://private_ip/path/to/bare/repo.git repo

but the bash say:

connect to host private_ip port 22: connection timed out please make sure you have the correct access rights

I try with a combination of access but none seems to work:

git clone ssh://user@public_ip:22/private_ip/path/to/bare/repo.git repo //permission denied (publickey)

git clone ssh://user@private_ip/path/to/bare/repo.git repo //connection timed out

am I missing something? What the correct url to connect to the private subnet under a tunnel? Is there a better way to manage the vcs?

Thank you

  • Does your user have ssh access to your repo? – Algeriassic Jan 28 '19 at 19:42
  • Hi, I can connect to the bastion (nat) on the public layer and from there I can ssh user@private_id and access the server. I can also connect through the tunnel with filezilla. – Mindexperiment Jan 29 '19 at 13:21
  • using the same username? – Algeriassic Jan 29 '19 at 14:41
  • yess, but when I open git bash and try to ssh to clone a bare repo I can't. – Mindexperiment Jan 29 '19 at 14:44
  • I set up another tunnel, user@public_ip:22 L3333 private_ip:22 with (allow agent forwarding). I add my private key to pageant. I launch the tunnel session. I open git bash. I want to connect to the repo in private_ip and the command I have to write is ..? – Mindexperiment Jan 29 '19 at 15:01
0

If you are listening on port 3333 and forwarding to private_ip:22, you need to use your localhost with the port you are listening on:

git clone ssh://user@localhost:3333/path/to/bare/repo.git repo

PS: Make sure your user has SSH access to the private_ip host

  • I run the command and the reply is "user@localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).". I'm sure user can access private_ip because I work on remote server daily. even filezilla can easily login through the tunnel – Mindexperiment Jan 29 '19 at 16:35
  • @Mindexperiment Well “Permission denied” means the connection did indeed reach the SSH server—for which you did not supply the required credentials. – Daniel B Jan 29 '19 at 16:43
  • ok , good news! But, I'm using the default ec2-user credentials, I don't think I have others credentials – Mindexperiment Jan 29 '19 at 16:49
  • As a test, did you try to ssh directly to localhost port 3333? – Algeriassic Jan 30 '19 at 4:35
  • I solve the problem by setting my public key as the authorized_keys on the private server. – Mindexperiment Jan 30 '19 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.