Use active mode FTP instead of passive mode during git-clone?
curl, ftp, git, git-clone
Solution
Git actually deprecated FTP, probably because of such difficulties:
Git supports ssh, git, http, and https protocols (in addition, ftp, and ftps can be used for fetching and rsync can be used for fetching and pushing, but these are inefficient and deprecated; do not use them).
Your best bet would be to rsync the remote repo from the FTP server to a local bare clone, and re-clone it to a working copy.
Problem
I have a GIT repository on a remote server that I want to access through FTP. For some unfortunate reason the server only allows active mode FTP instead of passive mode. i.e. If I use curl (same client used by `git clone`) to download a file directly, the following command works: ``` curl -P - ftp://user:pass@server/file ``` But taking the `-P -` out will cause curl to hang until time-out. The problem is I can't figure out how to tell `git clone` to use active mode for FTP. When I set `GIT_CURL_VERBOSE=1` and did a `git clone ftp://user:pass@server/repo`, I noticed that it is sending `PASV` instead of `PORT` and hangs just like curl without the `-P -` switch. How do I tell it to do otherwise? I read a bit about the `_netrc` file but couldn't find an example to set up active mode through it. For anyone curious, here are the verbose curl outputs from `git clone` (pretty much the same as running `curl` without specifying the `-P -` option.) ``` * About to connect() to server.com port 21 (#0) * Trying {server ip}... * 0x98d548 is at send pipe head! * Connected to server.com ({server ip}) port 21 (#0) < 220 Microsoft FTP Service > USER User < 331 Password required for User. > PASS {pass} < 230 User User logged in. > PWD < 257 "/User" is current directory. * Entry path is '/User' > CWD repo.git < 250 CWD command successful. > CWD info < 250 CWD command successful. > EPSV * Connect data stream passively < 500 'EPSV': command not understood * disabling EPSV usage > PASV < 227 Entering Passive Mode ({server ip},10,137). * Trying {server ip}... * Connecting to {server ip} ({server ip}) port 2697 /* server hangs from here until time-out */ ``` With the `-P -` option specified for curl, `PORT` command will be used in place of `PASV`, so starting from the `EPSV` line the following commands will be sent instead to the server: ``` > EPRT |1|{client ip}|13375| < 500 'EPRT |1|{client public ip}|36093|': command not understood * disabling EPRT usage > PORT {client ip},52,64 < 200 PORT command successful. * Connect data stream actively > TYPE I < 200 Type set to I. > SIZE file < 213 213 > RETR file < 150 Opening BINARY mode data connection for file(213 bytes). /* and the file just downloads from here. */ ``` My configuration: msysgit, MS-FTP server.