拒绝许可,请重试github

发布于 2025-02-02 01:13:25 字数 1435 浏览 4 评论 0原文

我想在使用 git push 命令时将文件自动上传到我的服务器。但是问题在于,它停止在键并给出错误(加载密钥“ /home/runner/.ssh/key”:无效格式)。在托管上,在GitHub存储库的设置中添加了键。也许有人面对类似的人?该问题如何解决?

upd:我通过更改键的输出来修复了错误,但是出现以下内容。.写入访问拒绝< /a>。

这是更新的代码:

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Setup key
      - run: set -eu
      - run: mkdir "$HOME/.ssh"
      - run: echo "${{ secrets.key }}" > "$HOME/.ssh/key"
      - run: chmod 600 "$HOME/.ssh/key"
      # Deploy
      - run: rsync -e "ssh -p 1022 -i $HOME/.ssh/key -o StrictHostKeyChecking=no" --archive --compress --delete . *server*:/*link*/public_html/

错误代码:

Run rsync -e "ssh -p 1022 -i $HOME/.ssh/key -o StrictHostKeyChecking=no" --archive --compress --delete . *server*:*link*/public_html/
Warning: Permanently added '*server*,[*IP*]:1022' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Received disconnect from *IP* port 1022:2: Too many authentication failures
Disconnected from *IP* port 1022
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]
Error: Process completed with exit code 255.

I'd like to have files automatically uploaded to my server when using the git push command. But the problem is that it stops at the keys and gives an error ( Load key "/home/runner/.ssh/key": invalid format ). On the hosting, the keys are added, in the settings of the github repository - too. Maybe someone faced similar? How can this problem be solved?

UPD: I fixed the error by changing the output of the key, but the following appeared .. Writes access denied.

Here is the updated code:

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Setup key
      - run: set -eu
      - run: mkdir "$HOME/.ssh"
      - run: echo "${{ secrets.key }}" > "$HOME/.ssh/key"
      - run: chmod 600 "$HOME/.ssh/key"
      # Deploy
      - run: rsync -e "ssh -p 1022 -i $HOME/.ssh/key -o StrictHostKeyChecking=no" --archive --compress --delete . *server*:/*link*/public_html/

Error code:

Run rsync -e "ssh -p 1022 -i $HOME/.ssh/key -o StrictHostKeyChecking=no" --archive --compress --delete . *server*:*link*/public_html/
Warning: Permanently added '*server*,[*IP*]:1022' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Received disconnect from *IP* port 1022:2: Too many authentication failures
Disconnected from *IP* port 1022
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]
Error: Process completed with exit code 255.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抠脚大汉 2025-02-09 01:13:25

尝试将密钥文件和文件夹.SSH权限更改为

  1. .ssh目录:700(DRWX ------)
  2. 公钥(.pub文件):644(-rw-r--r--r--)
  3. 私有密钥(ID_RSA) :600(-rw -------)

最后,您的主目录不应由小组或其他人(最多755(drwxr-xr-x)))

http://linuxcommand.org/lc3_man_pages/ssh1.html

Try to change key file and folder .ssh permissions to

  1. .ssh directory: 700 (drwx------)
  2. public key (.pub file): 644 (-rw-r--r--)
  3. private key (id_rsa): 600 (-rw-------)

lastly your home directory should not be writeable by the group or others (at most 755 (drwxr-xr-x))

http://linuxcommand.org/lc3_man_pages/ssh1.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文