git-ftp致命:无法获取最后一次提交。网络掉线了吗?网址错误?使用'git ftp init'进行初始推送

时间:2018-12-06 14:12:32

标签: git git-ftp

我使用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...

.git-ftp.log仍然在远程,并且我没有更改任何变量。发生了什么事?

2 个答案:

答案 0 :(得分:0)

原来,我的git ftp命令--user被意外替换为--auth,这是错误命令:

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

在我将git ftp命令中的字符串替换回之后,所有操作再次生效,这是正确的命令:

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

但是我已经读到一些建议,表明ftp是不安全的,所以我将git ftp命令替换为:

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

我还更改了BitBucket Pipeline YML文件,以使用最新的php基本映像(php:7),而不是我最初指定的旧版本(php:7.1.1)

答案 1 :(得分:0)

对于那些使用gitlab管道和directadmin作为cpanel替代方法的人。

有时,可能是由于ftp目录问题。如果使用directadmin,则可能会不时更改ftp目录。我真的不知道为什么directadmin会这样做。但是一旦转到FTP Account部分并查看在user设置中使用的gitlab的目录路径,您可能会看到目录不正确。

确认FTP目录路径。这帮助我解决了问题。希望这会帮助别人。