克隆远程Git仓库(服务器拒绝您更改到给定目录)

时间:2017-06-13 14:22:18

标签: git ftp clone vsftpd

我在远程服务器上设置了一个git repo。 我正尝试使用此命令在我自己的PC上克隆它:

  

git clone ftp://x.x.x.x/testGit/ testGit

但我一直收到错误:

  

致命:无法访问“ftp://x.x.x.x/testGit/”:服务器拒绝您更改为指定目录

同样的网址在我的浏览器中运行良好,我真的不明白...

我在这个配置中使用vsftpd

listen=YES
anonymous_enable=YES
local_enable=NO
write_enable=NO
local_root=/home/play/

我没有想法......

2 个答案:

答案 0 :(得分:4)

您需要在服务器上运行CurrentUser = context.Users.First(); //In load event :)

如果存储库是非裸的(即有一个git update-server-info目录),您还需要将.git附加到@Rohit Pothuraju所述的路径中。

如何调试此类问题?

我的第一次尝试是从 vsftpd 中获取详细的日志。我阅读了手册并设置了相关选项,但它不起作用(日志为空)。

所以我回过头来拦截TCP连接。最原始的方法是使用三个终端窗口运行以下命令:

/.git

现在,您将看到来自终端1中服务器的消息和来自终端2中程序的消息。当您在一个终端中看到消息时,将其复制并粘贴到另一个终端中。继续前进到会议结束。

提示:

  • 1. nc -v x.x.x.x 21 # connect to the real server 2. nc -l -v -p 1234 # listen on some port # if it says "This is nc from the netcat-openbsd package", remove the '-p' 3. git clone ftp://localhost:1234/testGit/ testGit # the program you want to debug, but with the server address replaced 标志导致netcat打印一个或两个调试行。确保不要在两个终端之间复制它们!在1号航站楼,这应该类似于

    -v

    并且在终端2中它应该类似于

    localhost [123.0.01] (?) open
    
  • 使用某些协议(如FTP),服务器会发送第一条消息。一旦程序连接,不要忘记复制该消息,否则它将永远等待。

答案 1 :(得分:0)

我建议你试试这个..

git clone ftp://username:password@ftp.company.com:PORT/project.repo/.git

它可能有用......