无法在 ubuntu 22.04 上安装 golang migrate

无法在 ubuntu 22.04 上安装 golang migrate
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
E: This command can only be used by root.
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  3954  100  3954    0     0   2478      0  0:00:01  0:00:01 --:--:--  2478
curl: (23) Failed writing body

答案1

您收到以下错误:

E: This command can only be used by root.

您应该以 root 身份运行该命令。尝试:

curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | sudo apt-key add -

相关内容