简体   繁体   English

将我的存储库推送到Github时出错

[英]Error Pushing my Repository to Github

I typed into the terminal: 我输入终端:

Parkers-MacBook-Pro:first_app ppreyer$ git push -u origin master
Username: 
Password:

And I get this error: 我得到这个错误:

error: The requested URL returned error: 403 while accessing https://github.com/ppreyer/first_app.git/info/refs

fatal: HTTP request failed

I'm guessing it has something to do with my username and password but I feel like I'm entering in the right information. 我猜想这与我的用户名和密码有关,但是我觉得我输入的是正确的信息。 Is there a way to figure out what my username and password are? 有没有办法弄清楚我的用户名和密码是什么?

Looks like your remote url is wrong. 看起来您的远程URL错误。

Try running the following commands: 尝试运行以下命令:

git remote rm origin
git remote add origin git@github.com:ppreyer/first_app.git
git push origin master

You might have cloned the public read only url. 您可能已经克隆了公共只读URL。 Also Its better if you can setup ssh key and add it in your github account . 如果您可以设置ssh密钥并将其添加到github帐户中,也是更好的选择。

Follow this guide . 请遵循本指南

To fix the problem you can facing , You can follow the answer posted by Gazier. 要解决您可能会遇到的问题,您可以按照Gazier发布的答案进行操作。 I am adding one more way of doing it. 我正在添加另一种方法。

  1. edit .git/config file under your repo directory 在您的repo目录下编辑.git/config文件
  2. find url=entry under section [remote "origin"] [remote "origin"]部分下找到url=entry
  3. make sure it is git@github.com:ppreyer/first_app.git 确保它是git@github.com:ppreyer/first_app.git

Now try to push the origin to master 现在尝试将原点推向高手

Add Your GitHub Username to Your "remote.origin.url" just before github.com in your url: 将GitHub用户名添加到您的URL中github.com之前的“ remote.origin.url”中:

https://ppreyer@github.com/ppreyer/first_app.git https://ppreyer@github.com/ppreyer/first_app.git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM