For me git clone from github via https works fine -
stevee@Inspiron-1501:/www/vhosts/moodle$ git clone https://github.com/moodle/moodle.git
Cloning into moodle...
remote: Reusing existing pack: 735172, done.
remote: Counting objects: 199, done.
remote: Compressing objects: 100% (175/175), done.
^Cceiving objects: 0% (1/735371)
So i suspect UFW is blocking git protocol.
With UFW disabled I am able to git clone git://git.moodle.org and tcpdump shows after DNS lookup transfer occurs on port 9418.
stevee@Inspiron-1501:/www/vhosts/moodle$ git clone -v git://git.moodle.org/moodle.git
Cloning into moodle...
stevee@Inspiron-1501:/var/www/vhosts/moodle$ sudo tcpdump -n -i wlan0
15:47:20.599254 IP 192.168.0.2.40446 > 194.168.4.100.53: 2582+ A? git.moodle.org. (32)
15:47:20.620586 IP 194.168.4.100.53 > 192.168.0.2.40446: 2582 1/0/0 A 174.123.154.58 (48)
15:47:20.621198 IP 192.168.0.2.45334 > 174.123.154.58.9418: Flags [S], seq 2782796998, win 14600, options [mss 1460,sackOK,TS val 969623 ecr 0,nop,wscale 4], length 0
15:47:20.755434 IP 174.123.154.58.9418 > 192.168.0.2.45334: Flags [S.], seq 1323455695, ack 2782796999, win 5792, options [mss 1460,sackOK,TS val 2057758346 ecr 969623,nop,wscale 7], length 0
With UFW enabled and an ALLOW OUT rule for port 9418 tcp dump shows no activity after DNS lookup -
stevee@Inspiron-1501:/var/www/vhosts/moodle$ sudo ufw status
Status: active
To Action From
-- ------ ----
Anywhere DENY Anywhere
53 ALLOW OUT Anywhere
22,80,443/tcp ALLOW OUT Anywhere
Anywhere DENY OUT Anywhere
9418 ALLOW OUT Anywhere
stevee@Inspiron-1501:/var/www/vhosts/moodle$ sudo tcpdump -n -i wlan0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes
16:16:18.114902 IP 192.168.0.2.41491 > 194.168.4.100.53: 54536+ AAAA? git.moodle.org. (32)
16:16:18.124604 IP 194.168.4.100.53 > 192.168.0.2.41491: 54536 0/1/0 (94)
by Steve Edwards.