如何绕过:remote: GitLab: Author <non-member-email-here> is not a member of team?

How to bypass: remote: GitLab: Author <non-member-email-here> is not a member of team?

我有一个 GitLab 项目(来源),最初是从另一个 GitHub 项目(github)克隆的。

$ git remote
github
origin

我通过以下方式实现了这一目标:

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

现在我想将 GitHub 的新更改合并到我的本地代码中。所以我做了以下

在我的本地计算机中,我从 GitHub

提取了更改
git fetch github

然后我将 GitHub 的 master 分支复制到名为 github-master

的本地分支
git checkout -b github-master github/master

现在我想将它推送到我的 GitLab 存储库,但它抱怨:

$ 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'

我该怎么办?

基本上,我和 https://gist.github.com/DavideMontersino/810ebaa170a2aa2d2cad

中的 Velmurugan Velayutham 有同样的问题

谢谢!

如图issue 17244,查看项目hook的配置:

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

您至少可以要求暂时停用上述挂钩,以完成您的初始推送。

请检查您的主目录中是否存在.gitconfig 文件。如果存在,则将用户名替换为 gitlab 中存在的用户。再次克隆 repo,进行更改并推送更改。这可能并不完美,但我想分享一下,因为它对我有用。