简体   繁体   English

git-ftp fatal:无法获得最后一次提交。 网络不通? 错误的网址? 使用“git ftp init”进行初始推送

[英]git-ftp fatal: Could not get last commit. Network down? Wrong URL? Use 'git ftp init' for the inital push

I use git-ftp and works fine for days, but suddenly went broken(after few hours I upload successfully), and the debug message is:我使用 git-ftp 并工作了好几天,但突然坏了(几个小时后我上传成功),调试消息是:

+ git ftp push -vv --syncroot folder/ --auth $USERNAME --passwd $PASSWORD $URL
Thu Dec  6 13:48:12 UTC 2018: Using syncroot folder/ if exists.
Thu Dec  6 13:48:12 UTC 2018: Host is 'myhost.com'.
Thu Dec  6 13:48:12 UTC 2018: User is ''.
Thu Dec  6 13:48:12 UTC 2018: Password is set.
Thu Dec  6 13:48:12 UTC 2018: Path is 'remote_folder/'.
Thu Dec  6 13:48:12 UTC 2018: Syncroot is 'folder/'.
Thu Dec  6 13:48:12 UTC 2018: CACert is ''.
Thu Dec  6 13:48:12 UTC 2018: Insecure is ''.
Thu Dec  6 13:48:12 UTC 2018: Retrieving last commit from ftp://myhost.com/.
* Couldn't find host myhost.com in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
*   Trying ***.***.***.**...
* Connected to myhost.com (***.***.***.**) port 21 (#0)
< 220 Host FTP Server
> USER anonymous
< 331 Password required for anonymous
> PASS ftp@example.com
< 530 Login incorrect.
* Access denied: 530
* Closing connection 0
curl: (67) Access denied: 530
Thu Dec  6 13:48:15 UTC 2018: fatal: Could not get last commit. Network down? Wrong URL? Use 'git ftp init' for the inital push., exiting...

The.git-ftp.log is still in remote, and I didn't change any variables. The.git-ftp.log 还在远程,我没有改变任何变量。 What's going on?这是怎么回事?

It turns out that my git ftp command --user has been accidentally replace to --auth , here is the error command:原来我的 git ftp 命令--user被不小心替换--auth ,这里是错误的命令:

git ftp push -vv --syncroot folder/ --auth $USERNAME --passwd $PASSWORD $URL

After I replace back the string in my git ftp command, all works again, here is the correct command:在我替换回我的 git ftp 命令中的字符串后,一切都再次工作,这是正确的命令:

git ftp push -vv --syncroot folder/ --user $USERNAME --passwd $PASSWORD $URL

But I've read some suggest that ftp is insecure, so I replace my git ftp command to:但是我读到一些建议 ftp 是不安全的,所以我将我的 git ftp 命令替换为:

git ftp push -vv --key ~/.ssh/my_ssh_key --syncroot folder/ --user $USERNAME --passwd $PASSWORD sftp://myhost.com/~remote_folder/

I also change my BitBucket Pipeline YML file to use the latest php base image (php:7) instead of the older one I had originally specified (php:7.1.1)我还更改了我的 BitBucket Pipeline YML 文件以使用最新的 php 基本图像 (php:7) 而不是我最初指定的旧图像 (php:7.1.1)

For those who are using gitlab pipeline and directadmin as cpanel alternative.对于那些使用gitlab管道和directadmin作为 cpanel 替代方案的人。

Sometimes, it might be because of ftp directory issue.有时,可能是因为 ftp 目录问题。 If you are using directadmin , it might change ftp directory time to time.如果您使用的是directadmin ,它可能会不时更改 ftp 目录。 I really don't know why directadmin does that.我真的不知道为什么directadmin会那样做。 But once you go to FTP Account section and see directory path for the user you are using in gitlab setting, you might see the directory is not correct.但是一旦您转到FTP Account部分并查看您在gitlab设置中使用的user的目录路径,您可能会看到该目录不正确。

Confirm FTP directory path.确认 FTP 目录路径。 This helped me fix my problem.这帮助我解决了我的问题。 Hope this will help someone else.希望这会帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM