I've struggled so much with this. I'm trying to push changes to the repo using the code below:
// Get remote
remote, err := repo.Remotes.Lookup("origin")
if err != nil {
remote, err = repo.Remotes.Create("origin", repo.Path())
if err != nil {
return err
}
}
// Get the branch
branch, err := repo.Branch()
if err != nil {
return err
}
// Get the name
branchName, err := branch.Name()
if err != nil {
return err
}
if err := remote.Push([]string{"refs/heads/"+branchName}, &git.PushOptions{}); err != nil {
return err
}
Everything seems fine, but I keep getting this error:
unpacking the sent packfile failed on the remote
Upon reading a few git resources, I now understand what the error means, but I still have no idea what is causing it.
Edit
I have just tried using Git as per @Carlos' suggestion, and I'm am getting more information now:
git push --set-upstream origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 241 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 http://xxxxxxx/xxxxxx/app.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'http://xxxxxxx/xxxxxxx/app.git'
I thought I got the permissions right though, here is how my Git directory looks like on the server:
root@CodeSpaces-001:/home/git# ll
total 40
drwxr-xr-x 5 git git 4096 Jul 29 19:22 ./
drwxr-xr-x 3 root root 4096 Jul 29 18:21 ../
drwxrwxr-x 3 git git 4096 Jul 29 19:22 apps/ # My repos are in here
Should this not be sufficient?