Raphael Rafatpanah Raphael Rafatpanah - 2 months ago 26
Git Question

git push not working after using CloudFlare reverse proxy

I recently started using CloudFlare (reverse proxy) with my DigitalOcean Droplet (root access server) where I had set up

git push
deployment.

Of course,
git push
no longer works and returns this error:

ssh: connect to host example.com port 22: Operation timed out


This is most likely because
git
is trying to access a repo on CloudFlare's servers instead of my DigitalOcean server.

What is the best way to restore
git push
functionality?

Answer

You'll need to update your remote's URL to either use the raw IP, or add a DNS A record in the CloudFlare panel like raw.example.com with the CloudFlare orange cloud thing disabled (so it resolves directly to your host). Then update your git remote setting:

git remote set-url origin git@127.0.0.1:foo/bar.git

or

git remote set-url origin git@raw.example.com:foo/bar.git