Manolo
Manolo

Reputation: 26350

unable to pull .gitignore file

I've modified my .gitignore file from my VPS. Then I've commit the change and pushed to remote repo:

git add .gitignore
git commit -m ".gitignore changed"
git push -u origin --all

and then, I pull it to localhost:

git pull

But I get the next error:

error: unable to unlink old '.gitignore' (Permission denied)

I've tried changing permissions of .gitignore local file to 0777, but doesn't work. The file in remote repo has been changed, but not in my local file What could be the problem? and how could be solved?

Upvotes: 2

Views: 5639

Answers (2)

Manolo
Manolo

Reputation: 26350

The answer was easy:

sudo git pull

Edit:

I had probably wrong permissions (better said, owner) in the .git directory. It's better to change the owner of this directory and files instead:

sudo chown -R yourGitUser ./.git

Upvotes: 4

functionpointer
functionpointer

Reputation: 1441

Seems like a permission problem. Try applying 0775 rights to the .git folder, not only .gitignore.

Upvotes: 2

Related Questions