Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Feb 11, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Feb 11, 2017

when attempting to push changes to upstream I am faced with the following:
git commit -m "init" [master (root-commit) ec6447c] init 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test $ git push Counting objects: 3, done. Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To git@gitserver:/git-server/repos/runscripts ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'git@gitserver:/git-server/repos/runscripts'
I have changed the ownership of the mounted /git-server to the UID of the git user in the container.
Any way to solve this?

@jkarlosb
Copy link
Owner

Hi fraksken,
It is a permissions problem with your repo. You maybe can fix it by typing:

  • docker exec -it git-server sh
  • cd /git-server
  • chown -R git:git repos
  • chmod -R ug+rwX repos
  • find repos -type d -exec chmod g+s '{}' +

I'll update the code soon for fix this problem, with SGID bit (g+s). This way when you upload a new repo, files created in the directory repos belong to the group of which the directory repos is a member, i.e. those files are members of the same group as the directory repos and not the user’s group.

Thank you very much for finding the problem.
Tell me whether you solved your problem or not. I'll try to help you if I can.

@ghost
Copy link
Author

ghost commented Feb 13, 2017

Hey jkarlosb,
Thank you so much for this solution. I will test it today after work. (+8h)
It would be great if you could also write a little how-to on how to create a new repository.
Most solutions require the repository to be created in the GUI side (github, gitlab, ...).

Thank you very much

@ghost
Copy link
Author

ghost commented Feb 15, 2017

Hey jkarlosb,
I'm sorry for the delay. Your fix worked as advertised. Thanks!

@jkarlosb
Copy link
Owner

Hi fraksken!

Sorry for the delay. I was very busy in my job this week.

I'm really glad that it worked for you. And of course! I'll write a how-to about creating new repos with git soon, needless github, gitlab, etc., great idea.

Thanks to you! Any suggestions or comments are welcome for enhanced this project.

@jkarlosb
Copy link
Owner

jkarlosb commented Feb 23, 2017

I updated readme.md file with a how-to about create a new Git repo from CLI, without using any GUI. It's very quick as you can check.

How to create a new repo:

  • $ cd myrepo
  • $ git init --shared=true
  • $ git add .
  • $ git commit -m "my first commit"
  • $ cd ..
  • $ git clone --bare myrepo myrepo.git

@ghost
Copy link
Author

ghost commented Feb 24, 2017

Thank you so much. This will be very helpful!

@ghost ghost closed this as completed Feb 24, 2017
@jkarlosb jkarlosb reopened this Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant