Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github error: insufficient permission for adding an object to repository database

Tags:

git

github

chown

I used to be able to do, from my App folder:

git add .
git commit -m "commit details"
git push

and the latest version of my app on my local machine would be backed up on in my master repo, on github.

Now, when I get as far as just the git add . command, I get:

mycompaq@ubuntu:~/myapp$ git add .
error: insufficient permission for adding an object to repository database .git/objects

error: app/views/reviews/update.js.erb: failed to insert into database
error: unable to index file app/views/reviews/update.js.erb
fatal: updating files failed
mycompaq@ubuntu:~/myapp$ 

I read in a message on Stackoverflow the way to overcome a similar problem was with:

chown -R user:user /project/directory

But seeing as I got in a whole load of trouble in the first place by running commands I wasn't sure about, I want to know if this is the command for me. What does it do? Can it be undone?

What should the exact syntax be, if the user is 'Christophe', and the folder where my Rails app is stored is called 'myapp'. I mean should it be

chown -R user:christophe /myapp/app/views/reviews/update.js.erb

Sorry for all the questions.

like image 396
CHarris Avatar asked Aug 19 '13 22:08

CHarris


1 Answers

  1. Make sure you're inside the repository where you're getting the error.

  2. Get your username by typing

    whoami

  3. Enter this command

sudo chown -R your_user_name .git/*

like image 145
Dwain Avatar answered Sep 19 '22 20:09

Dwain