Search code examples
gitsocketssshcpanelshared-hosting

git clone issue [ socket: Address family not supported by protocol ]


I'm on a shared hosting (huge mistake). I have ssh'ed into it and trying to clone a private repository from bitbucket.org:

git clone git@example.com:MyStuff/private-repository.git

but facing this issue:

socket: Address family not supported by protocol

ssh: connect to host bitbucket.org port 22: Address family not supported by protocol

Now looking at this page: https://forums.gentoo.org/viewtopic-t-127306-start-0.html. I think maybe I need to disable the use of ipv6 by ssh to connect to the host. I can't do that (shared hosting).

Any help?


Solution

  • I would use clone over SSL in such case, like so

    git clone https://<repo-url>
    

    another nice trick if you don't want to type your password each time, you can use credential helper like so:

    git config --global credential.helper cache
    git config --global credential.https://github.com.username foo
    git clone https://github.com/foo/repository.git
    

    The above will cause Git to ask for your password once every 15 minutes (by default).