2013年12月19日 星期四

[Git] error: The requested URL returned error: 403 while accessing https://github.com/username/repo.git

今天看了github的教學, 在github新增一個repo
然後在本機端要commit回去, 出現了這個錯誤訊息
error: The requested URL returned error: 403 while accessing https://github.com/username/repo.git

其實這也不奇怪, 預設HTTP是沒有write權限, 所以被擋住也是應該的, 但為什麼github的教學還用這當例子?

所以stackoverflow的人又回答了, 把https改成ssh就好了
1.edit .git/config file under your repo directory
2.find url=entry under section [remote "origin"]
3.change it from url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to url=ssh://git@github.com/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
4.Save config file and quit. now you could use git push origin master to sync your repo on GitHub

沒有留言: