shell - Shell Runner 内的 Curl Upload-File
问题描述
我正在尝试从 gitlab-shell-runner 中通过 curl 上传单个文件。
基本上我需要使用这个命令:
curl --user <user:password> --insecure --upload-file <file> https://example.com
显示以下错误:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument "<user:password>"
我需要做哪些调整才能在 gitlab-ci 中运行它?
我已经尝试使用一个变量来表示地址和不同的引用变体。
先感谢您!
解决方案
如“在 64 位 Windows 上运行 cURL ”中所述,您正在运行 CmdLet
被调用的 ,它在 PowershellInvoke-WebRequest
中有一个别名。
首先删除它:curl
Remove-item alias:curl
然后检查您的脚本是否确实调用了实际curl
命令(或者您可能需要显式调用它)。
或者:使用Invoke-WebRequest
(aliased ' curl
') 和Basic $encodedCredentials
header。
推荐阅读
- reactjs - 页面重新加载后本地存储不保留数据
- python - Matplotlib 改变图形大小
- r - 如果语句条件在 R 中被忽略
- javascript - 返回特定值与任何其他数组值匹配的对象
- filter - 当 SMA 50 超过 SMA 200 时,如何编写脚本以仅绘制买入 MACD 信号
- arrays - 为什么我会收到此错误消息(“实例方法 'appendInterpolation(_:formatter:)' 要求 'Any' 继承自 'NSObject'”)?)
- python - Unittest mock getsize 似乎没有模拟
- c# - 我无法导入 Zxing 库
- sqlalchemy - sqlalchemy - 3 级会员计划
- android - getWindow().setFlags(int flags, int mask) 中的标志和掩码参数是什么?