Why "git pull" command over https from github repository need "sudo" as prefix?
My OS is ubuntu, I have some codes located on github.com, everything is ok before, but one day, when I typing:
git pull
I'm asked to input password as usual, and then I get this error.
error: couldn't connect to host while accessing https://ghosert@github.com/ghosert/VimProject.git/info/refs fatal: HTTP request failed
until I try sudo prefix like:
sudo git pull
It works as before once again. It seems I lost the p开发者_如何学运维ermission on accessing https when git need it. Anyone has idea on this?
The error you posted doesn't indicate that the problem was permissions.
error: couldn't connect to host while accessing
https://ghosert@github.com/ghosert/VimProject.git/info/refs fatal: HTTP request failed
"HTTP request failed" sounds like a connectivity problem.
I would simply bet that your internet connection failed when you typed it the first time, and was back up when you typed it again, with sudo
, which I doubt had any effect on fixing the problem.
Worse, it probably messed up your permissions now, refer to sarnold's answer.
I faced the same problem today and here is my analysis and solution.
I set proxy settings system wide in my chrome browser for some purpose and it seems that it has created some environment variables which are causing my working shell to believe that their is no connectivity as i killed the proxy server when the job was finished. The env variables were not removed.
Check if your env has some unnecessary variables set. env --this command will show all the env variables set in you shell.
Variables:
http_proxy, https_proxy
Remove them and everything will work.
精彩评论