I pulled a repository and cleaned irrelevant parts. Locally everything is perfect. I want to keep history from previous repo.
Then I created another repository, a clean one. But push is failing due to pre-receive hook declined
I am quite sure I don't have that kind of stuff on my repository :)
I tried with several commands like --force-with-lease, without a luck.
What can be the problem here, Is there something wrong with previous repository that I pulled from.
git push --verbose --set-upstream origin Last-backup:pushed-from-different-repo --force-with-lease
Pushing to [email protected]:tkcn/history-recovery.git
Enter passphrase for key '---/.ssh/id_rsa':
Counting objects: 415402, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (129955/129955), done.
Writing objects: 100% (415402/415402), 78.71 MiB | 271.00 KiB/s, done.
Total 415402 (delta 229277), reused 411834 (delta 226634)
remote: Resolving deltas: 100% (229277/229277), done.
remote: Checking connectivity: 415402, done.
remote: GitLab: Push operation timed out
remote:
remote: Timing information for debugging purposes:
remote: Running checks for ref: pushed-from-different-repo
remote: Checking if you are allowed to push... (5.83ms)
remote: Checking if default branch is being deleted... (0.12ms)
remote: Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab... (25.63ms)
remote: Checking if branch follows the naming patterns defined by the project... (3.38ms)
remote: Validating diff contents... (cancelled after 41262.16ms)
To gitlab.localhost:tkcn/history-recovery.git
! [remote rejected] Last-backup -> pushed-from-different-repo (pre-receive hook declined)
error: failed to push some refs to '[email protected]:tkcn/history-recovery.git'
git subtree split and git filter-branch --prune-empty didn't worked since the folders moved several times in the history.
Most suitable solution on stackoverflow looks like https://stackoverflow.com/a/14764368/559873 However I am unable to run this on my windows machine.
The pre-receive hooks are executed on the remote git server (gitlab, github or any git server) not the workstation/server where you have your git repository cloned, (do not confuse with pre-commit hooks, pre-commit hooks scripts are executed before you commit to your cloned repo and are located in YOUR_REPO/.git/hooks/)
Basically the git remote server where you are trying to push your Project (repo in github language), has a pre-commit hook enabled, that is usually set up on purpose by the owner/admin of the Group (equivalent to organization in GitHub) in order to ensure that any push event is following certain quality checks.
EDITED:
If you pay attention on the verbosity of the push error of your git push, you can see several check steps have been passed like the branch name, etc but it fails because the validating diff part is taking longer than the timeout.
remote: Validating diff contents... (cancelled after 41262.16ms)
You can also contact the admin of the Group (organization) where your project/repo lives in for further details on the quality checks expected by the pre-receive hook
After running garbage collection I was able to push successfully.
git reset --hard
git gc --aggressive
git prune
git clean -df
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With