4

I have a GitLab project (origin) that was originally cloned from another GitHub project (github).

$ git remote
github
origin

I made this happen by:

git remote add github https://the-git-hub-remote.git

Now I want to merge GitHub's new changes into my local code. so I did the following

In my local computer, I pulled changes from GitHub

git fetch github

I then copy the GitHub's master branch into a local branch called github-master

git checkout -b github-master github/master

Now I want to push it to my GitLab repo but it complains:

$ git push origin
Enumerating objects: 6813, done.
Counting objects: 100% (6083/6083), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1842/1842), done.
Writing objects: 100% (5721/5721), 2.09 MiB | 42.05 MiB/s, done.
Total 5721 (delta 4008), reused 5313 (delta 3735)
remote: Resolving deltas: 100% (4008/4008), completed with 224 local objects.
remote: GitLab: Author 'brian.riley@ucop.edu' is not a member of team
To my-git-lab-remote.git
 ! [remote rejected]   github-master -> github-master (pre-receive hook declined)
error: failed to push some refs to 'git@my-git-lab-remote.git'

What should I do?

Basically, I have the same problem as Velmurugan Velayutham in https://gist.github.com/DavideMontersino/810ebaa170a2aa2d2cad

Thanks!

Henry Yang
  • 1,873
  • 3
  • 17
  • 29

2 Answers2

5

As illustrated in issue 17244, check the configuration of the project hook:

Check whether author is a GitLab user
Restrict commits by author (email) to existing GitLab users

You could at least ask to desactivate temporarily said hook, to allow your initial push to complete.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
  • Same problem here. Would be nice to know how to disable the preinstalled GitLab wide hook. Currently I do not find the hook in the filesystem, nor do I find a possibility how to disable it in the UI. UI shows no hooks at all. – defoe Feb 03 '20 at 12:42
  • @defoe Do you have access to the GitLab server? Or is it gitlab.com? – VonC Feb 03 '20 at 13:01
  • I do have access to the GitLab server, it's a local instance. – defoe Feb 03 '20 at 15:17
  • @defoe Then check in the bare repo/hooks folder (repository storage path: https://docs.gitlab.com/ee/administration/repository_storage_paths.html), and see if there is a symlink in place in that `hooks` subfolder. – VonC Feb 03 '20 at 15:19
  • Thanks for your help, turns out it was a push rule within the local repository. – defoe Feb 04 '20 at 08:21
  • @defoe Interesting. A pre-receive hook of some kind then? (https://docs.gitlab.com/ee/push_rules/push_rules.html) – VonC Feb 04 '20 at 08:25
  • Yes it's the "Check whether author is a GitLab user" push rule. – defoe Feb 04 '20 at 08:45
  • @defoe How did you disabled it? – VonC Feb 04 '20 at 08:48
  • It's a local GitLab instance, so I have access to the repo settings. – defoe Feb 04 '20 at 09:37
-1

Please check whether file .gitconfig exists in your home directory. If it exists then replace user name with user exists in gitlab. Clone repo again, make changes and push the change. This might not be perfect but thought to share as it worked for me.

amit shah
  • 25
  • 1
  • 4