git - git-ftp 致命:无法获得最后一次提交。网络断了?错误的网址?使用 'git ftp init' 进行初始推送
问题描述
我使用 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 仍在远程,我没有更改任何变量。这是怎么回事?
解决方案
原来我的 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)
推荐阅读
- python - 如何在网页上训练我自己的自定义词嵌入?
- go - 所有的 goroutine 都在休眠 - 死锁!与等待组
- excel - 如何选择文件并将文件路径粘贴到嵌入的文本框中?
- python - 如何将来自 Active Directory 的图像数组转换为 Python 以保存在驱动器中?
- permissions - 有没有办法让 wagtail modeladmin 中每个用户的数据可见?
- php - Swiftmailer 不向 yahoo.com 或 icloud.com 发送电子邮件
- apache-flink - org.apache.flink.table.api.TableException: 结果的 Arity [3] 与请求类型的 number[2] 不匹配
- python-3.x - Keras 应用模型列表的区别
- java - 无法通过android中的进程生成器编译和运行c代码
- python - 如何获取 javascript 变量的内容?