git push -u 原主,用户名和密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19198232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push -u origin master, username and password
提问by Hanna M. Selvaag
I am currently going through Hartl's Ruby on Rails tutorial, and I am stuck in the GitHub section. The following happens whenever I try to push my repository up to GitHub:
我目前正在阅读 Hartl 的 Ruby on Rails 教程,但被困在 GitHub 部分。每当我尝试将我的存储库推送到 GitHub 时,就会发生以下情况:
Hannas-MacBook-Air:first_app Hannananana$ git remote add origin https://github.com/hannaselvaag/first_app.git
Hannas-MacBook-Air:first_app Hannananana$ git push -u origin master
Username:
Password:
^[error: The requested URL returned error: 403 while accessing
https://github.com/hannaselvaag/first_app.git/info/refs
fatal: HTTP request failed
I have created a username and password at github.com, but the terminal wont let me type anything in it. Any suggestions?
我在 github.com 上创建了一个用户名和密码,但终端不允许我在其中输入任何内容。有什么建议?
回答by VonC
You must use your GitHub account username: hannaselvaag.
And your GitHub account password.
您必须使用您的 GitHub 帐户用户名:hannaselvaag.
以及您的 GitHub 帐户密码。
Not create a new username and password (like an ssh passphrase) just for that repo.
不要仅为该存储库创建新的用户名和密码(如 ssh 密码)。
Change your remote in order to add your GitHub username account in the url:
更改您的遥控器以在 url 中添加您的 GitHub 用户名帐户:
git remote set-url origin https://[email protected]/hannaselvaag/first_app.git
Then try again the git push -u origin master, entering only your GitHub password.
然后再试一次git push -u origin master,只输入您的 GitHub 密码。
回答by Jason Foglia
For Bitbucket:
对于比特桶:
git remote add origin https://bitbucket.org/hannaselvaag/first_app
For Github:
对于 Github:
git remote add origin https://github.com/hannaselvaag/first_app
You just had to remove the .git at the end of the url
您只需要删除 url 末尾的 .git

