在本地新建git示例

echo "# t3" >> README.mdgit initgit add README.mdgit commit -m "first commit"git remote add origin https://github.com/boss999/t3.gitgit push -u origin master

git config --global user.name "Your Name"
git config --global user.email [email protected]


error: The requested URL returned error: 403 Forbidden while accessing https://github.com/boss999/t3.git/info/refs

solve:这是权限问题,可以修改.git/config文件追加用户名和密码

详细:

From:http://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http-request-failed

To definitely be able to login using https protocol, you should first set your authentication credential to the git Remote URI:

git remote set-url origin https://[email protected]/user/repo.git

Then you'll be asked for a password when trying to git push.

In fact, this is on the http authentication format. You could set a password too:

https://youruser:[email protected]/user/repo.git

You should be aware that if you do this, your github password will be stored in plaintext in your .git directory, which is obviously undesirable.

…or push an existing repository from the command line

 
git remote add origin https://github.com/boss999/t3.git
git push -u origin master



猜你喜欢

转载自hugoren.iteye.com/blog/2241174