简体   繁体   English

我可以通过我的GitLab帐户为GitHub上托管的项目做贡献吗?

[英]Can I contribute to a project hosted on GitHub from my GitLab account?

I'm new to Git and have started with GitLab which I quite like. 我是Git的新手,已经很喜欢GitLab。 One of the projects that I'd like to contribute to is hosted on GitHub. 我想贡献的项目之一托管在GitHub上。 Is there a way for me to contribute to the project from my GitLab account? 我可以通过我的GitLab帐户为该项目做贡献吗? Is this a bad practice? 这是不好的做法吗? Are there any limitations? 有什么限制吗?

Technically yes, but you may find that it's not easy getting others to play along. 从技术上讲是可以的,但是您可能会发现让其他人一起玩并不容易。

Both GitHub and GitLab are backed by git, in theory. 理论上,GitHub和GitLab都由git支持。 The way git works is you make your changes, and then you either send the patches for those changes to the maintainer, or you put your changes at a publicly accessible URL and ask them to pull from you. git的工作方式是您进行更改,然后将这些更改的补丁程序发送给维护人员,或者将更改放置在可公开访问的URL上并要求他们从您那里提取。 It's called a pull request, and exactly what it sounds like. 这称为“拉取请求”,听起来像是这样。 It's literally just a message that you send to somebody asking if they will do a git pull from your branch. 从字面上看,这只是一条消息,您发送给某人,询问他们是否会从您的分支进行git pull The git client includes a command git request-pull that will format a message that fits a default template giving an overview of which commits are ready that you can use for this purpose. git客户端包括一个命令git request-pull ,该命令将格式化适合默认模板的消息,以概述可以准备用于此目的的提交。

In practice, people on GitHub and GitLab generally don't work this way. 实际上,GitHub和GitLab上的人通常不会以这种方式工作。 GitHub users use GitHub-style "pull requests", and GitLab users use GitLab-style "merge requests". GitHub用户使用GitHub风格的“拉请求”,而GitLab用户使用GitLab风格的“合并请求”。 These are just buttons in the websites' interfaces that work with their own custom APIs. 这些只是网站界面中使用其自定义API的按钮。 GitHub-style pull requests have† to come from other projects hosted on GitHub, and GitLab-style merge requests have† to come from GitLab. GitHub风格的合并请求必须来自GitHub上托管的其他项目,而GitLab风格的合并请求则必须来自GitLab。 There's nowhere for you to attach your patches on GitLab or GitHub. 您无处可在GitLab或GitHub上附加补丁。 There's no way to go to a project hosted on GitHub and create a pull request by pasting in the URL where the changes are located.‡ 无法粘贴到GitHub上托管的项目并通过粘贴更改所在的URL创建拉取请求。‡

† There's no special technical reason for this. †没有特殊的技术原因。 They're just written that way. 他们就是这样写的。

‡ You can dump these things into an issue comment, but your mileage may vary as far as getting any other response than the project maintainer telling you they don't accept patches and they don't do real pulls by adding your remote and doing a git pull and they don't accept any changes from people who don't use GitHub. ‡您可以将这些内容转储到问题注释中,但是您得到的响应可能会有所不同,除了项目维护人员会告诉您他们不接受补丁而且他们没有通过添加远程控制器并进行真正的拉动之外,其他响应git pull ,他们不接受不使用GitHub的人的任何更改。

You can work on your own git repo wherever you want. 您可以随时随地使用自己的git repo。 GitHub, GitLab, BitBucket, VSTS, local files, etc. GitHub,GitLab,BitBucket,VSTS,本地文件等

However, to contribute back to a GitHub repo, you may be asked to issue a pull request from a fork of the original repo on GitHub. 但是,要回馈到GitHub存储库,可能会要求您从GitHub上原始存储库的分支发出拉取请求。

Good news is, you can always work wherever you want and set the GitHub fork as a "remote", and push to it when you are ready to make a pull request 好消息是,您可以随时随地工作,并将GitHub分支设置为“远程”,并在准备发出请求时推送到它

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

相关问题 将仓库从gitlab自托管服务器迁移到github账号 - Migration of repositories from gitlab self-hosted server to github account 我可以使用我的工作 (Gitlab) 提交显示在我的公共(个人)GitHub 帐户上吗 - Can I use my work (Gitlab) commits to show up on my public (personal) GitHub account 我的 GitLab 项目中来自 GitHub 的存储库 - Repository from GitHub in my GitLab project 在我的 GitHub 上显示来自 GitLab 帐户的 git 贡献 - Show git contributions from GitLab account on my GitHub 当我将 github 帐户连接到 gitlab 时,我无法克隆 Gitlab 存储库 - i cannot Clone a Gitlab repository when i connected my github account to gitlab 如何镜像托管在 github 上的启动板上的项目? - How can I mirror a project hosted on launchpad on github? 如何将Github中的代码添加到Codepen项目中? - How can I add code from Github into my Codepen project? 我可以从Gitlab存储库中的Github存储库导入分支吗? - Can I import a branch from a Github repository in a Gitlab repository? 从同一个本地项目部署到 github 和 gitlab - Deploy to github and gitlab from same local project 如果github上的某个存储库的所有者已停止处理某个项目但我想为此做出贡献该怎么办? - What if the owner of some repository on github has stopped working on some project but I want to contribute to it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM