[Yarn] Unable to connect to github.com

Today when I cloned a new project and ran yarn install, the below error popped up.

yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads git://github.com/WearyMonkey/ngtemplate-loader.git
Directory: /home/xxx/source/github.com/xxx/xxx/app
Output:
fatal: unable to connect to github.com:
github.com[0: 220.28.17.148]: errno=Connection timed out

The solution is to execute the below command under the cloned git repository.

git config --global url."https://".insteadOf git://

If this post helped you to solve a problem or provided you with new insights, please upvote it and share your experience in the comments below. Your comments can help others who may be facing similar challenges. Thank you!
Buy Me A Coffee
DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !