简体   繁体   English

镜像配置文件活动以及镜像存储库从 GitLab 到 GitHub

[英]Mirror profile activity along with the mirrored repository from GitLab to GitHub

I have the following scenario:我有以下情况:

  • I have a repository in GitLab which I set to mirror into GitHub under the same name;我在 GitLab 中有一个存储库,我将其设置为以相同的名称镜像到 GitHub;
  • I am the owner of both repos (original one and the mirror);我是两个回购协议(原始的和镜像的)的所有者;
  • when I commit to GitLab, all the changes are automatically pushed into GitHub mirror via personal access token;当我提交到 GitLab 时,所有更改都会通过个人访问令牌自动推送到 GitHub 镜像中;
  • my profile activity is updated on GitLab, however, on GitHub there are no changes.我的个人资料活动在 GitLab 上更新,但是在 GitHub 上没有任何变化。

One of the suspected reasons is that both of my GitLab and GitHub accounts use private emails, which means that GitHub cannot recognize that the author of commits is actually me and does not update my profile activity.怀疑的原因之一是我的 GitLab 和 GitHub 帐户都使用私人电子邮件,这意味着 GitHub 无法识别提交的作者实际上是我并且不会更新我的个人资料活动。

The other possible reason I thought about was the permissions of personal access token.我想到的另一个可能的原因是个人访问令牌的权限。 Apart from "repo" permissions I also granted "user" permissions, to get r/o access on email data.除了“回购”权限外,我还授予了“用户”权限,以获取对 email 数据的 r/o 访问权限。 But that didn't seem to work, after making a test commit.但是在进行测试提交之后,这似乎没有用。

I am currently trying to sync both of my GitLab and GitHub accounts to a single email adress.我目前正在尝试将我的 GitLab 和 GitHub 帐户同步到一个 email 地址。 I do not like this option, because I feel comfortable using private adresses.我不喜欢这个选项,因为我觉得使用私人地址很舒服。 And I also feel like I'm potentially going into the wrong direction here.而且我也觉得我可能会在这里走错方向。

So if you have any ideas on how to do this -- I would appreciate if you shared your knowledge!因此,如果您对如何执行此操作有任何想法 - 如果您分享您的知识,我将不胜感激!

Ok, I found the solution myself.好的,我自己找到了解决方案。

Basically, as I suspected (but did not check first), both GitLab and GitHub accounts must be linked to the same public email address .基本上,正如我所怀疑的(但没有先检查),GitLab 和 GitHub 帐户必须链接到相同的公共 email 地址

In addition, I just found out that GitHub has an interesting policy on registering contributions: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-settings-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile#commits另外,我刚刚发现GitHub有一个关于注册贡献的有趣政策: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing -contribution-settings-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile#commits

In my case, I commited to the non-deafult branch, so the contributions I made showed on GitLab, but not on GitHub.在我的例子中,我提交给了非默认分支,所以我所做的贡献显示在 GitLab 上,但没有显示在 GitHub 上。

Anyway, I hope this will help someone in the future.无论如何,我希望这对将来的人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM