I have got a virtual private server with nginx Virtual Hosts setup (Server Blocks).
I\'ve installed Git and got my ssh keys authenticated with GitHub.
I have
You should logged in not as "root" user.
Or assign permission to your "current_user" to do this by using following command
sudo chown -R username.www-data /var/www
sudo chmod -R +rwx /var/www
I think you don't have your permissions set up correctly for /var/www Change the ownership of the folder.
sudo chown -R **yourusername** /var/www
I was facing same issue then I read first few lines of this question and I realised that I was trying to run command at the root directory of my bash profile instead of CD/my work project folder. I switched back to my work folder and able to clone the project successfully
Change ownership and permissions folder
sudo chown -R username.www-data /var/www
sudo chmod -R +rwx /var/www