我在github上创建了一个名为pygame的存储库.创建了一个克隆并添加了文件并提交了.但是当我尝试推送时,我收到以下错误:
git push -u origin master
error: The requested URL returned error: 403 while accessing https://github.com/amalapk/pygame/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)
我可以ssh git@github.com并收到我成功登录的通知,但无法推送到我的存储库.
小智 27
我最近在设置我的github项目的新克隆时遇到了这个问题.
您需要在表单的项目URL中包含您的用户名
https://user@github.com/project/...
Run Code Online (Sandbox Code Playgroud)
例如,为我的测试github提供的URL是这样的:
https://github.com/jdblair/test.git
Run Code Online (Sandbox Code Playgroud)
如果我添加我的用户名,就像这样,那么我可以毫无问题地从github推送和拉取:
https://jdblair@github.com/jdblair/test.git
Run Code Online (Sandbox Code Playgroud)
从克隆项目开始,最简单的方法是使用包含用户名的URL.
您可以更改现有项目的URL,如下所示:
git remote set-url origin https://user@github.com/project/foo/bar.git
Run Code Online (Sandbox Code Playgroud)
如果需要,您可以使用ssh身份验证,但这是一个单独的设置过程.
Jos*_*rdo 12
Github现在要求我们使用git 1.7.10或更高版本:
https://help.github.com/articles/error-the-requested-url-returned-error-403
Von*_*onC 11
在GitHub的远程页提到的回购读/写地址:
确保您的克隆地址如下:
https://github.com/username/yourRepo.git
Run Code Online (Sandbox Code Playgroud)
你已经定义了:
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"
Run Code Online (Sandbox Code Playgroud)
如果你使用git地址(没有ssh),你还需要:
git config --global github.user username
git config --global github.token 0123456789yourf0123456789token # no longer needed
Run Code Online (Sandbox Code Playgroud)
(您的令牌来自"帐户设置">点击"帐户管理员".)
更新2013:您仍然可以生成令牌(请参阅" 为命令行使用创建访问令牌 "),但您可以将其用作https url的密码.
实际上,如果您在GitHub上激活2FA(双因素身份验证)机制,则需要为您的https网址添加令牌(因为您的常规密码会触发第二步验证).
请参阅" 配置Git客户端,如GitHub for Windows,不要求身份验证 "
请参阅" 我应该使用哪个远程URL? ".
一切都在remote.
将您当前的遥控器更改https://github.com/amalapk/pygame.git为git@github.com:amalapk/pygame.git并享受.
要做到这一点......(假设您当前的遥控器被称为原点)
git remote set-url origin git@github.com:amalapk/pygame.git
Run Code Online (Sandbox Code Playgroud)
Tho*_*ger -4
请按照http://help.github.com/create-a-repo/上的说明进行操作
您已使用公共只读URL克隆了存储库。
实时FM
| 归档时间: |
|
| 查看次数: |
27596 次 |
| 最近记录: |