2

So I'm brand spanking new to Git and development in general. I'm a Linux and Mac user on a few different machines and have a couple cloud servers with AWS, I work on small little python projects on all of them.

I'll try to explain what I want first, hopefully I'm close to having the best solution that will work for my use case. I want to be able to write code on whatever device I own, Ubuntu desktop at home, work Macbook, cloud servers, Ubuntu desktop at work, and a personal Macbook. Obviously I'm working with different hostnames and usernames, I'm the only one that works on my code.

I went through the git guide and it's working, sort of. I tried to setup my repository on my cloud server which I will also be changing code on. I've been trying to commit and push from my Macbook but have been getting a string of permission errors all day, I've been having to go back to the repo and chown -R as my ssh wheel user since every object there is getting overwritten as root.

Here are some sample error messages I'm seeing when trying to push from my macbook:

A commit:

macbook:dev macbookuser$ git commit
# On branch master
# Your branch is ahead of 'origin/master' by 6 commits.
#
nothing to commit, working directory clean

And then the push:

macbook:dev macbookuser$ git push
user1@myserver-aka-repo.com's password: 
Counting objects: 18, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (14/14), 1.62 KiB, done.
Total 14 (delta 7), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To user1@myserver-aka-repo.com:/home/myserver-aka-repo/dev/.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'user1@myserver-aka-repo.com:/home/myserver-aka-repo/dev/.git'
Juddles
  • 747
  • 1
  • 7
  • 12

1 Answers1

1

If the chown and umask 0002 don't fix this on the server, make sure the repo you are pushing to has been shared with the right mode.

 git config core.sharedRepository

See "Git Push Error: insufficient permission for adding an object to repository database" for more on this option.

I usually set core.sharedRepository to umask, and set my umask to 0002.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250