There are a couple good posts on this subject, but I am not sure if they apply to my circumstances.
Error pushing to GitHub - insufficient permission for adding an object to repository database
Git Push Error: insufficient permission for adding an object to repository database
When performing a push as a normal user, I receive the following error:
remote: error: insufficient permission for adding an object to
repository database ./objects
Note that I can push if I am logged on the local machine as root. I see from the below that the origin is git#easybbb.com:root I don't know if it matters, but the remote repository I am trying to push to is hosted by me using GitLab.
The local git directory is 0775 and belongs to group "www", I've executed chmod -R g+rwxs /var/www/ to ensure that new files are of group "www", the normal user that is trying to push belongs to group "www", and I've executed git config core.sharedRepository group.
How do I fix this error?
git push origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 487 bytes | 0 bytes/s, done.
Total 6 (delta 5), 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#easybbb.com:root/bidjunction.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'git#easybbb.com:root/bidjunction.git'
git remote -v
origin git#easybbb.com:root/bidjunction.git (fetch)
origin git#easybbb.com:root/bidjunction.git (push)
It has nothing to do regarding the many similar questions. The key is "remote: error: ". The problem is the remote repository (GitLab which is similar to GitHub). Making all associated files owned by git solved the problem.
Related
I have a node app in my local machine, which works totally fine on localhost, i have tried to push the code to github repository, if it didn't work, i created new repos and tried again
I even adopted both methods to push using git bash:
using ssh and http
In my .gitignore file i have written node_modules/
But every time i get the same error message and code is not pushed to my github repo, the error is :
$ git push -u bb4 main
Enter passphrase for key '<path for ssh key>':
Enumerating objects: 2484, done.
Counting objects: 100% (2484/2484), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2457/2457), done.
Writing objects: 100% (2484/2484), 272.37 MiB | 679.00 KiB/s, done.
Total 2484 (delta 492), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (492/492), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 7eaa2fe7b701a22ea9b13333b122831363593fb6a0ce25c557df3aa90fa29f9e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File mongod.pdb is 367.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File mongos.pdb is 247.35 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:<username>/<reponame>.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'github.com:ritish73/bb4.git'
it shows two too large files mongod.pdb and mongos.pdb, where are these files coming from , i thought they might be in node_modules but i have already added that to .gitignore file.
There is also a .git(hidden) directory inside my project directory which is a local repo of the project handled by vscode itself, Could it be causing some issue? (though i did add this to .gitignore too, still didn't work).
What could be the problem here? Happy to hear your thoughts and resolve this error. This is my directory structure where i run git bash.
Clearly github doesnt allow too big files, you got that right.
You also added node_modules to your .gitignore which is good, too.
You shouldnt add your .git directory, tho, since this is created when you ran git init - this directory is essential for your local git repository.
I guess that you added your node_modules in some previous commit, thus it is added in your history, meaning that the resulting diffs would be pushed to the repository.
You would have to alter these commits to exclude node_modules but for the sake of simplicity it would just create a new git repository (by deleting .git and run git init again)
There seems to be so called Github hook to deny your push, see [remote rejected] main -> main (pre-receive hook declined) error message.
Whoever initialized the repository (maybe you), set up a custom git hook to do some pre-checks before anything is pushed.
I am using AWS SageMaker and unbeknownst to me the EC2 created a checkpoint for a .csv file that I added to .gitignore due to its size. Therefore, I accidentally added the checkpoint file to be committed.
To remove the file from staging, I performed a hard reset by executing git reset HEAD --hard.
I received the following response:
HEAD is now at c2770a8 add updates
When I executed git status, I was informed the following:
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Consequently, I submitted git push origin master and I encountered the following error:
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (15/15), 61.39 MiB | 5.80 MiB/s, done.
Total 15 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: cee6ca9f888bed2a49b7bbd5de9edb1a
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File data/.ipynb_checkpoints/traffic_crashes-checkpoint.csv is 212.62 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/Morgan-Sell/Chicago-Traffic-Risk.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Morgan-Sell/Chicago-Traffic-Risk.git'
(1) How come the reset is not clearing my staging?
(2) How do I know what corresponds to c2770a8?
Thanks!
The problem you have is that your problem file is already committed. Adding a file to .gitignore doesn't remove it from being committed. git reset --hard HEAD (and that's how you should write it, with options before arguments) also doesn't remove files that are already committed; it resets the working tree and index to the specified commit. Since the commit already contains the problem file, you haven't changed anything in it.
What you probably want to do is git reset --soft HEAD^, assuming the latest commit is the one in which you added the problem file. That will undo your latest commit and leave all of the files staged. You can then run git reset data/.ipynb_checkpoint to remove any staged files in that directory, and the commit again.
If you added the problem file in an earlier commit, then you'll want to do a git rebase -i COMMIT^ where COMMIT is the commit that added the problem file, and then mark the problem commit as edit instead of pick, save, and quit your editor. Then, when Git stops, run git rm -r --cached data/.ipynb_checkpoints && git commit --amend --no-edit && git rebase --continue which will remove the file and finish the rebase.
I'm trying to push some changed to an existing github repo. I cloned the repo onto my computer, changed a few lines in some files from it and then tried git push origin master. It returns this:
To https://github.com/judah-tw/myrepo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/judah-tw/myrepo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I try git pull origin master and this shows up:
warning: no common commits
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 85 (delta 19), reused 13 (delta 13), pack-reused 62
Unpacking objects: 100% (85/85), done.
From https://github.com/judah-tw/myrepo.git
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
Auto-merging readme.txt
CONFLICT (add/add): Merge conflict in readme.txt
Auto-merging main.c
CONFLICT (add/add): Merge conflict in main.c
Automatic merge failed; fix conflicts and then commit the result.
git merge returns this:
error: merge is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
What does it mean to fix them in the work tree? I followed the instructions on https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ but they're not working for me.
I am new to git and have been following various tutorials on setting up a centralized git server. For the past few days, I have been having trouble with the following error message:
Counting objects: 59, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (59/59), done.
Writing objects: 100% (59/59), 525.33 KiB | 0 bytes/s, done.
Total 59 (delta 15), reused 0 (delta 0)
remote: fatal: failed to read object 24e3826fe4be7dbaddbfcd698e943b5b8f9598ec : Bad file descriptor
error: unpack failed: unpack-objects abnormal exit
To ssh://git#[server url]/volume1/git/[project name]
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'ssh://git#[server url]/volume1/git/[project name]'
Initially, I used GitEye on my client side to manage git repository, but I encountered the problem when I tried to push my first commit to my linux server. So I played around with the permission and set the ownership of the whole git directory recursively to user "git". Nothing works. So I tried cloning a bare repository from the server and then try the push, but that didn't work either...returning me with unpacker error.
So I switch my software to Git Extensions and also trying the push on Git Bash...still the same error. Oh, forgot to mention that in the process, I deleted my local and remote git repository various times.
While one may argue that this may be a duplicate of git push over sshfs failing with “error when closing sha1 file: Bad file descriptor”, but I don't use sshfs and I am running Windows on my client side.
This may be a duplicate of Git push error - fatal: file '' write error: Bad file descriptor, but the push never works before.
UPDATE:
With mentioning about the version, I wonder if the version mismatch between the server and the client is the source of the problem. So I downgrade my client git version from 1.9.4 to 1.8.4.msysgit.0, but still found the problem after deleting and recreating a new git repository.
What interesting though is that I also tried to copy manually the git repository from the client to the server and do a git status on the remote side. As a result, I encounter the bad file descriptor, but that error didn't appear on the client side.
I found the source of the problems. I tried to do a first commit on my remote side and I got "not a valid object" error. Thus, I have a bad git build on my remote side. Thanks for your guidance. It points me the right path to look.
Now I have to figure how to get a newer (or different) version of git for my remote platform without having to use ipkg.
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'
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.