Tried rebasing to production branch off a clean branch I haven't made any changes to that is a little behind.
Was told I have uncommitted changes and to either commit them or stash them, but git status
reveals no changes were made to any files on this branch.
So just for the hell of it, decided to stash changes. When I try that, I get error:
fatal: Unable to create '/var/www/MyProject/.git/index.lock': Permission denied
Cannot save the current index state
So I tried this trick:
sudo rm -f /var/www/MyProject/.git/index.lock
But that didn't help. So I tried again, following that command with git reset
but reset throws the same permission denied error.
So then I tried sudo git reset
which worked, but then when I tested git rebase production
I get this error:
First, rewinding head to replay your work on top of it...
fatal: Unable to create '/var/www/MyProject/.git/index.lock': Permission denied
could not detach HEAD
How do I fix these permission issues?
This is a vagrant box running Ubuntu 14.04.
You are using different users to create and manage your repository. Your repo was created by www-data and you're logged in as vagrant.
Your options are:
su www-data
) before doing git work.chown -R vagrant *
)chgrp -R vagrant *
)config.vm.synced_folder
configuration covers this: see the Vagrant Docs.Whatever you do, make sure anything else that needs to use git retains whatever access it needs. Since www-data created the repo, it's likely that you used some sort of web service / application to do it; therefore, if you change the owner of the repo to vagrant, you probably need to change the web service / application so that it is run by vagrant, too.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments