When I am pushing to remote Git repo, the push was rejected because...

tnir

T "@tnir" N

Posted on April 15, 2022

When I am pushing to remote Git repo, the push was rejected because...

Git' pre-push hook can be configured in repo by repo.

gitlab-org/gitlab repo introduced it with Lefthook gem.

Due to Ruby packages (via Rubygems), I need to update all the packages corresponding Gemfile/Gemfile.lock on HEAD after:

$ git checkout master (or main) && git pull
Enter fullscreen mode Exit fullscreen mode

While I just wanted to modify some Markdown, why need to update all Ruby packages?

Here is the trouble I had this morning when just docs are to be updated, which demotivate me for a while:

$ git push origin HEAD
Lefthook v0.7.5
RUNNING HOOKS GROUP: pre-push

eslint (SKIP. NO FILES FOR INSPECTION)

graphql_docs (SKIP. NO FILES FOR INSPECTION)

  EXECUTE > docs-metadata
Documentation metadata found in 1 documentation files.


docs-deprecations (SKIP. NO FILES FOR INSPECTION)

haml-lint (SKIP. NO FILES FOR INSPECTION)

docs-removals (SKIP. NO FILES FOR INSPECTION)

  EXECUTE > vale
✔ 0 errors, 0 warnings and 0 suggestions in 1 file.


  EXECUTE > markdownlint
yarn run v1.22.17
$ markdownlint --config .markdownlint.yml doc/install/requirements.md
Done in 0.38s.


stylelint (SKIP. NO FILES FOR INSPECTION)

prettier (SKIP. NO FILES FOR INSPECTION)

rubocop (SKIP. NO FILES FOR INSPECTION)

gettext (SKIP BY SETTINGS)

  EXECUTE > danger
 Could not find omniauth-alicloud-1.0.1 in any of the sources
Run `bundle install` to install missing gems.


SUMMARY: (done in 2.59 seconds)
✔️  docs-metadata
✔️  vale
✔️  markdownlint
🥊  danger
error: failed to push some refs to 'https://gitlab.com/gitlab-org/gitlab.git'
Enter fullscreen mode Exit fullscreen mode

For long time, it has been that independency from Ruby looks better to me in these cases (for Git hooks).

GitLab

Life is too short for me to understand why it is.

💖 💪 🙅 🚩
tnir
T "@tnir" N

Posted on April 15, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related