0

I have a git bare repository hosted on a server. I checked out a local git repository, made quite a few changes and then pushed it to the server. I also have a jenkins build box which uses a git hook to schedule a build on the develop branch and merge changes to master branch on the server if all is successful.

Those changes that I committed and pushed were reverted using a reset and merge. So the origin/develop origin/head and origin/master all point to a previous point in history.

Now the problem I have is on the continous integration box it fetches fine from the remote server builds the project fine, creates a tag but when it tries to do a push it spits out the following :

Pushing HEAD to branch master of origin repository

/usr/bin/git config --get remote.origin.url /usr/bin/git push ssh://192.168.34.xxx/usr/git/xxxxxx-xxx.git HEAD:master ERROR: Failed to push merge to origin repository hudson.plugins.git.GitException: Command "/usr/bin/git push ssh://192.168.34.xxx/usr/git/xxxxxx-xxx.git HEAD:master" returned status code 1: stdout: stderr: 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 ssh://192.168.34.xxx/usr/git/xxxxxx-xxx.git ! [remote rejected] HEAD -> master (unpacker error) error: failed to push some refs to 'ssh://192.168.34.xxx/usr/git/xxxxxxx-xxx.git'

The issue is that this push worked fine before the reset to the server, I am assuming the push is failing because the server is modified and so a pull and merger or fetch needs to be done on the jenkins build box first locally.

I have also read a bit about permission issue that might be on the server I doubt this is the issue because this worked fine previously till I did the reset to the server. According to my understanding of git a push would fail if the place being pushed to was modified, so a pull and merge needs to be done first.

I was thinking to pull the origin/master branch down merge it with the local master and push those changes or reset the local master to be the same as origin/master.

I apologise in advance if I am not clear in places. I have limited experience with git but I have done quite a bit of reading recently. I am just scared to try stuff not knowing the implications and also I am not sure what I am thinking will actually work.

Please could I get assistance. Thanks.

  • A quick answer first to clarify: You write _"a pull and merge"._ [`git pull`](https://www.kernel.org/pub/software/scm/git/docs/git-pull.html) performs `fetch` + `merge`. _"I am just scared to try stuff not knowing the implications"_ - This is good attitude. Git is great but not very forgiving. It can be quite challenging to clean it up if something went wrong, especially at the beginning. – Gerold Broser Oct 19 '14 at 20:02
  • Did you find [Error pushing to GitHub - insufficient permission for adding an object to repository database](http://stackoverflow.com/questions/1918524/error-pushing-to-github-insufficient-permission-for-adding-an-object-to-reposi) and [Git Push Error: insufficient permission for adding an object to repository database](http://stackoverflow.com/questions/1918524/error-pushing-to-github-insufficient-permission-for-adding-an-object-to-reposi)? – Gerold Broser Oct 19 '14 at 20:10
  • Just a git repository on a server. I tried a pull and strangely I got To https://github.com/user/repo.git # ! [rejected] master -> master (non-fast-forward) – user3569521 Oct 21 '14 at 02:59

0 Answers0