I've spent the past few days trying to set up a Git Remote on my server so I can push changes to my web-server to it. The problem is that I'm getting the following errors while doing it:
$ git push --porcelain --progress --recurse-submodules=check live refs/heads/master:refs/heads/master 'master' pushed: d689cce..4e755fc Delta compression using up to 4 threads. Total 3 (delta 2), reused 0 (delta 0) remote: error: unable to create file .gitignore (Permission denied) remote: error: unable to create file .gitignore~ (Permission denied) remote: error: unable to create file index.js (Permission denied) remote: error: unable to create file package.json (Permission denied)
Now, I get that this has something to do with file and folder ownership, and that I and/or git may or may not have write access to certain folders.
Trouble is I don't have the faintest clue which folder I can't write to or how to resolve it.
I'm brand new to messing with setting up a web-server from scratch, so here's what I did:
I went through How To Set Up Automatic Deployment with Git with a VPS to try and see how I should get the remote up and running. This lead me to create the following two folders:
Without being told anything about permissions I went ahead and tried to push to the remote as told, immediately running into the first permission roadblock.
So I consulted a friend who suggested I should make a new group, add my user to the group, and then have
/var/repo be owned by said group with the
775 read/write/execute permissions. He also suggested I should do as suggested here to make sure the
/var/www folder had the right permissions; but even after all that I still can't push to the remote as shown in the error above.
So what am I supposed to do to fix this? I'm kinda at a roadblock here.
Some info about the stuff I use:
- Client OS: OSX Yosemite
- Server OS: Ubuntu 15.04
- Git Client: SmartGit 6.5 (for convenience)
- I use SSH rather than HTTPS to connect to the remote