2

I ran into a very weird problem trying to put an existing local repository onto my server for sharing. I followed this tutorial: http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server Locally, I use Git Extensions (on Windows) with Putty, specifying the remote as git@my_server.com.

However, when I try to push my local repository I get:

error: insufficient permission for adding an object to repository database ./objects

I logged into the server as user "git", went to the repository checked for problems. All file permissions were correct (belonging to git) and I can create new files. Trying to find out what went wrong I looked at the system auth log:

Feb 11 07:35:45 MY_SERVER sshd[22334]: pam_unix(sshd:session): session opened for user my_user by (uid=0)
Feb 11 07:35:47 MY_SERVER sshd[22334]: pam_unix(sshd:session): session closed for user my_user

So it looks like Git Extensions is trying to use a different user (my_user) to log into the system and then has some problem with permissions. This is even persistent when I generate a new private key for git and use this key for authentication, so it should not even be able to log is as my_user.

Now I often use my_user with Putty, but don't see how it could end up being used by Git Extensions. Furthemore, git and my_user are in the same group and the repository is shared among the group members (git config core.sharedRepository), so this should not even be a problem. I also don't understand how git can log in as my_user. I have used my_users private key in the beginning, but then replaced it. So Git Extensions must have the old settings stored somewhere. I tried to unset the credential helper (Win Store" but that didn't change anything.

If you have any idea what is going wrong, please let me know.

Makx
  • 305
  • 1
  • 11
  • possible duplicate of [Git Push Error: insufficient permission for adding an object to repository database](http://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab) – Makoto Feb 11 '15 at 07:24
  • Thanks! But as I wrote: I have set BOTH the file permissions correctly (and tested it) AND set `git config core.sharedRepository`. So this issue is different. – Makx Feb 11 '15 at 07:29

1 Answers1

-1

I can relate to this problem! This happened to me too:

remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object

I've read that this happens because of a restriction of the operational system's permissions system.

If I remember correctly, one has to change file permissions by using 'chmod'

This link (Git Push Error: insufficient permission for adding an object to repository database) saved me a lot of time! It covers more/other details.

Goodluck.

-Joey

Community
  • 1
  • 1
Joey Dorrani
  • 371
  • 1
  • 1
  • The next time you feel that a question can be answered by another question here, please mark it as a duplicate. There's little to gain in terms of reposting the link or reposting its contents here (not that you did the latter, of course). – Makoto Feb 11 '15 at 07:25
  • Thanks anyway! But as I wrote: in my case all file permissions are correct. It seems to be a log-in problem. – Makx Feb 11 '15 at 07:26