Search code examples
gitubuntupermissionspushsudo

Git push says - The requested URL returned error: 403 but with sudo - works


If i use command

git push 

It says fatal: unable to access 'http://***.git The requested URL returned error: 403 If i add sudo sudo git push it works fine. Where should i add permissions?

I tried

sudo find /var/www/.git -type d -exec chmod 0777 {} +

And

sudo find /var/www/.git -type f -exec chmod 0777 {} +

But it only helps me to commit from my user


Solution

  • So my ip changed(local) when i get new computer. Previously in our company was corporate proxy. So i entered:

    export https_proxy=""
    export http_proxy=""
    

    And add in your local repository folder

     sudo chown -R YourUserName .git/ 
    

    if you need to clone project in folders such var from user use

     sudo find /var/ -type d -exec chmod 0777 {} +
     sudo find /var/ -type f -exec chmod 0777 {} +