Tag Archives: git commit

How to Solve Git commit error: error: insufficient permission for adding an object to repository database .git/objects

Problem:

git add or git commit error:

error: insufficient permission for adding an object to repository database .git/objects
error: insufficient permission for adding an object to repository database .git/objects
error: Error building trees

solution

sudo chown -R cygr-0101-01-0133 *

cd .git

sudo chown -R cygr-0101-01-0133 *

central reason

https://stackoverflow.com/questions/28832815/git-commands-require-sudo-on-osx

In fact, when our versiongit clonerequires systemssudopermissions, and our system is connected. It should be that ssh requires system privileges. Even if it works, then it also requires the git fetch and git push. But at least, saving is not bad…

Detected Detection

chown -R < If this option is checked, KDM will show a list of users, so users can click on their name or image rather than typing in their login. myproject

 

Solve the GIT commit error and bypass the code check

Svn was used in the last project and git was used in the new project. I was very happy and finally learned GIT. I thought I had learned git, but I still encountered a problem that was not within the scope of my knowledge points. Finally, my colleagues helped solve it

Question: when the code commits for the first time, it always reports errors. After reading the error information, it seems that the code errors will be checked before committing, but the code has no errors. Can it run?Will the errors checked by eslint be checked out, and then the commit fails?Finally, I found a solution on the Internet

 

first, let’s get to know git’s hook:

Hooks are stored in the hooks subdirectory under the GIT directory. That is. Git/hooks in most projects. When initializing a new version library with git init, GIT will place some sample scripts in this directory by default. In addition to being called by themselves, these scripts also reveal the parameters passed in when triggered. All the examples are shell scripts, some of which are mixed with Perl code, but any properly named executable script can be used normally

 

  GIT_DIR/hooks/pre-commit  :

This hook is called by the GIT commit command and can be skipped by adding the — no verify parameter to the command. This hook requires no parameters and is called before getting the commit message and starting the commit. If the return value of the hook is not 0, the GIT commit command will abort execution

Note: this hook can be used to check for code errors before submitting (for example, running a lint program)

When the default pre commit hook is enabled, if it finds a blank line at the end of the file, it will abort the submission