0

In my company, whenever I want to push to git server from within the company, I have no problem as the .git/config file is like:

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = me@172.x.x.x:/home/git/repositories/YYY

our company has a public IP and they say the access to our git server is from :

137.a.a.a:bbb

I need to push to the remote branch from home, but I dont know how to configure the git using this IP, I tried to change the above url to

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = me@137.a.a.a:bbb/home/git/repositories/YYY

but there was no luck.the error says:

ssh: connect to host 137.a.a.a port 22: Connection timed out
fatal: The remote end hung up unexpectedly

There problem could be a firewall or other networking issue. But before that, I want to make sure if my change is correct or not. thank you

rahman
  • 4,820
  • 16
  • 52
  • 86

1 Answers1

3

Instead of changing your existing remote, I suggest adding a new one. In the end they will point to the same server, but I personally prefer to use local IPs when possible. To add a new remote, you simply execute git remote add <name> <Address> You can then access the remote like origin, just replace any occurrence of origin with your new name.

This will not fix your problem, however. The problem seems to be that you don't get a connection. My guess is, that you are trying to use a port, but use wrong syntax, try this: url = ssh://me@137.a.a.a:bbb/home/git/repositories/YYY This turns it into a real url, the way you did it before does accept ports afaik.

Source

Community
  • 1
  • 1
Xandaros
  • 645
  • 1
  • 6
  • 17
  • I created another remote, and then followed the second step. This time it was able to connect and ask for password but it then says: `fatal: '/home/git/repositories/YYY' does not appear to be a git repository, fatal: The remote end hung up unexpectedly` – rahman Oct 08 '13 at 07:40
  • That basically means your remote path is wrong. It found no repository at the path you set. – Xandaros Oct 08 '13 at 09:52