I using Starbucks wifi and I get the following when trying to push to a gitlab.com repo:
$ git push origin master
ssh: connect to host gitlab.com port 22: Connection refused
fatal: Could not read from remote repository.
I tried adapting a workaround for GitHub: Github (SSH) via public WIFI, port 22 blocked by adding the following to ~/.ssh/config
Host gitlab.com
Hostname gitlab.com
Port 443
But that doesn't work as I get this error:
$ git push origin master
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I there a workaround that will allow me to push to GitLab.com using port 443?
Since February 2016, you are no longer required to switch to https.
You can push to GitLab in ssh on... port 443 (the port usually reserved for https transaction)
See "GitLab.com now supports an alternate git+ssh port"
GitLab.com runs a second SSH server that listens on the commonly used port 443, which is unlikely to be firewalled.
[ You might have to change your remote origin url:
]
Thanks to @oleg-gopkolov for giving me the hint to try defining the origin differently! It turns out ssh port 443 didn't work but https did as per below.
How to switch origin to https so that pushing to gitlab.com works while on on Starbucks wifi
Here are the commands to switch to https (if you had experimented with other changes and your local is out of date like mine was you will also need to follow Cannot push to GitHub - keeps saying need merge ):
If you want to do some testing on a fresh checkout
It turns out that using the https checkout option does work. So provided you don't mind a fresh checkout, you can run this on Starbucks wifi:
Then to test committing you can edit README.md and then run:
If you want to confirm that SSH GitLab access doesn't work on Starbucks wifi
To confirm that SSH cloning does not work at Starbucks you can run one of the following 3 commands:
And for each one you will get an error like this:
Define your remote such that it uses port 443
git remote add origin ssh://some.host:443/path/to/repo.git