Is it possible to specify a rule for a file for a specific branch? - gitolite

I have a GIT repository foo with 2 branches: branch1 and branch2. I want to set up a gitolite rule that denies pushing modifications for this file only for branch1 for bar user. This is what I've tried so far:
repo foo
- branch1/this = bar
repo foo
- branch1/NAME/this = bar
repo foo
- branch1 /NAME/this = bar
I don't even know if this is possible with gitolite.
Any help very much welcome. Thanks in advance.
EDIT: I tried this 2 configurations as suggested. The following:
- branch1 VREF/NAME/this = bar
RW branch2 VREF/NAME/this = #all
rejects both branches
remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch2
remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch1
To debian:testing.git
! [remote rejected] branch2 -> branch2 (hook declined)
! [remote rejected] branch1 -> branch1 (hook declined)
error: failed to push some refs to 'debian:testing.git'
While the following
RW branch2 VREF/NAME/this = #all
- branch1 VREF/NAME/this = bar
allows both branches to be pushed
To debian:testing.git
f6bc01d..09b63ab branch2 -> branch2
7a868cf..09bcb63 branch1 -> branch1
Using the same branch (branch1)
RW branch1 VREF/NAME/this = #all
- branch1 VREF/NAME/this = bar
To debian:testing.git
9c50fc4..02f350d branch1 -> branch1
- branch1 VREF/NAME/this = bar
RW branch1 VREF/NAME/this = #all
remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch1
To debian:testing.git
! [remote rejected] branch1 -> branch1 (hook declined)

It should be:
repo foo
- branch1 VREF/NAME/this = bar
I used a similar VREF-based rule for "gitolite disallow access for directory on master branch but not on user branch".
'VREF/...' is the important part ('NAME' alone won't work, 'VREF/NAME' will)

Related

error on git push --set-upstream origin beanch_name

When i give the command git push --set-upstream origin US8938439 it gives error as below:
remote: GitLab: You cannot push commits for
'X56789#TFC-6JNm6RqXvb6.bbtnet.com'. You can only push commits if the
committer email is one of your own verified emails.To
ssh://git#gitlab.bbtnet.com:90088/DummyProject ! [remote rejected]
US8938439 -> US8938439 (pre-receive hook declined) error: failed to
push some refs to 'ssh://git#gitlab.bbtnet.com:90088/DummyProject'
Please help me to understand what is causing the error:
You cannot push commits for 'X56789#TFC-6JNm6RqXvb6.bbtnet.com'. You can only push commits if the committer email is one of your own
verified emails
-(pre-receive hook declined)

Git push heroku main > pre-receive hook declined

When I give the command git push heroku main it fails to build and shows the following error:
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs
How can I solve this error?

Gitlab shows remote: This server is readonly

Can't push the changes to any existing repository (Or) to new repository.
Error while pushing the changes:-
git push -u origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 226 bytes | 226.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: ================================================
remote: This server is readonly
remote: ================================================
To gitlab.domain.com:gitlab-user/test30-jan-2020.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#gitlab.domain.com:gitlab-user/test30-jan-2020.git'
GitLab GUI --> Under Admin--> Settings-->General & Repository settings checked, seems settings are fine.
And GitLab Server gitlab.rb file also doesn't have readonly settings mode enabled.
Any other clue/input to enable write mode?
Server side there was a custom hook /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d which was preventing the push. Same has been removed it started working.

Gitolite refuses to accept commits to gitolite-admin.git

I am following this tutorial to install a gitolite server on my Debian PC. Once that works, I intend to connect to it from a virtual machine, to simulate client connection.
$ cd ~/ssh
$ ssh-keygen glite
$ sudo apt-get install gitolite3
$ export GL_LIBDIR=/home/default/bin/lib
$ export GL_BINDIR=/home/default/bin
$ gitolite setup -pk /home/default/.ssh/glite.pub
$ cd ~/projects
$ git clone ../repositories/gitolite-admin.git
# make some changes
$ git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 413 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: WARNING: Use of uninitialized value $repo in concatenation (.) or string at /home/default/bin/lib/Gitolite/Conf/Load.pm line 251, <DATA> line 1.
remote:
remote: FATAL: invalid repo ''
remote: error: hook declined to update refs/heads/master
To ../../repositories/gitolite-admin.git/
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '../../repositories/gitolite-admin.git/'
So some variable $repo is empty inside some python script. What am I missing?
Perhaps your local user has only read-persission ?
check the entry in your
../repositories/gitolite-admin/conf/gitolite.conf
there should be an entry coresponding to your glite.pub file name in keydir.
repo gitolite-admin
RW+ = glite

Git push - node.js failed to push some refs

I am trying to push a node.js application, but I run into following issue:
Total 226 (delta 25), reused 0 (delta 0)
remote: /usr/share/gems/gems/openshift-origin-node-1.18.0.1/lib/openshift-origin-node/model/application_repository.rb:50:
warning: Insecure world writable dir /var/lib/openshift/532aba62493209b14e000001 in PATH, mode 040777
remote: Stopping NodeJS cartridge
remote: Permission denied - /var/lib/openshift/532aba62493209b14e000001/app-deployments/2014-03-20_02-52-39.976/dependencies/nodejs/node_modules/express
To ssh://532aba62493209b14e000001#myapp-test.openshift.local/~/git/myapp.git/
! [remote rejected] master -> master
(pre-receive hook declined)
error: failed to push some refs to 'ssh://532aba62493209b14e000001#myapp-test.openshift.local/~/git/myapp.git/'
Found that could be a known issue https://bugzilla.redhat.com/show_bug.cgi?id=1054421.
Can anyone help me here?
Thanks.

Resources