无法将文件添加到github

时间:2013-02-01 20:25:23

标签: github

我想将文件添加到github中,如下所示:

git init
touch test.txt
git add test.tst
git cmmit -m'testtest'
git push origin master

然后它会引发这个异常:

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

fatal: HTTP request failed

然后我验证公钥是否附加到我的github帐户:

$ ssh -T git@github.com
Hi yacheng1127! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh-add -l
2048 1a:a1:33:26:21:68:7e:9c:26:19:fb:74:a4:d1:6b:bd yacheng1127@gmail.com (RSA)

然后我检查我的远程网址:

$ git remote -vorigin   
origin      https://github.com/yacheng1127/YWProject.git (fetch)
origin  https://github.com/yacheng1127/YWProject.git (push)

我不知道问题出在哪里。有人能帮助我吗?谢谢

1 个答案:

答案 0 :(得分:0)

当您使用遥控器的“git://”网址时,使用ssh密钥,您可以更改此内容(https://help.github.com/articles/changing-a-remote-s-url)。

但是“https://”也应该工作(读/写),但它不能使用你的ssh密钥或ssh代理,你应该给git你的github登录名和密码:

https://help.github.com/articles/set-up-git#password-caching