Git push to a company self-hosted repository fails


I successfully cloned a company self-hosted repo to my computer.

When running git remote -v I receive the following (with substitutions for company and software name for privacy)

origin  ssh:// (fetch)
origin  ssh:// (push)

I can run git fetch without any issues and my current git status is

On branch main
Your branch is ahead of 'origin/main' by 2 commits.
  (use "git push" to publish your local commits)

When running git push though I get the following

Enumerating objects: 16, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 1.14 KiB | 1.14 MiB/s, done.
Total 8 (delta 3), reused 6 (delta 1), pack-reused 0
error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: remote unpack failed: unpack-objects abnormal exit
To ssh://
 ! [remote rejected] main -> main (n/a (unpacker error))
error: failed to push some refs to 'ssh://'

Even though remote push address is correctly defined when running git push this strips out the brian@ in front which in theory seems to be why it fails with insufficient permissions.

I am uncertain what to try next - I have tried a number of git push commands of different types but they either fail for the reason above or because of an error which is clearly related to a malformed or not relevant command. If anyone could assist I would appreciate it.

Many thanks

Is there any chance someone else pushed to the repository under their account? In that case some files might have been created as being owned by them, without write access for you.

Exactly how to fix it will depend on how you want to set up access rights, but note that there is a repository configuration option to configure group access or file modes.