首页 > 解决方案 > Git Push 失败并在 Windows 中返回 403

问题描述

环境

我想将一些源推送到 git 存储库。

但是推动它存在一些问题。

错误信息如下:

D:\workspace\excel-demo>git push -u origin master Counting objects:
42, done. Delta compression using up to 8 threads. Compressing
objects: 100% (28/28), done. Writing objects: 100% (42/42), 50.75 KiB
| 2.82 MiB/s, done. Total 42 (delta 2), reused 0 (delta 0) error: RPC
failed; HTTP 403 curl 22 The requested URL returned error: 403
Forbidden fatal: The remote end hung up unexpectedly fatal: The remote
end hung up unexpectedly Everything up-to-date

我在远程信息中设置了凭据,例如test@~~~~/~~~.git

我应该怎么办?

标签: windowsgitpushgogs

解决方案


test@~~~~/~~~.git不是“凭据”(登录名/密码),而是一个 SSH URL,这意味着:以用户“test”连接到远程服务器,并~~~.git用作远程 Git 存储库目标。

假设您的 %USERPROFILE%.ssh 中有一个 SSH 密钥对。
并且公钥 (id_rsa.pub) 已在~test/.ssh/authorized_keys.

如果不是这种情况,您需要检查远程服务器希望您如何进行身份验证(用户名/密码?SSH 密钥?)


推荐阅读