Can a GitHub organization commit code to a repository?

时间:2016-03-02 11:02:32

标签: github github-organizations

I'm trying to understand, what an "organization" on GitHub actually is -- an independent account with all capabilities of a user account and additionally some specials or just a "repos container", that need a separate user account for user specific activities. So my question is:

Is it possible to push code to GitHub as organization (using the organization's login) or does an organization always need a personal account to get code into an organization's repository using personal account login?

3 个答案:

答案 0 :(得分:4)

组织只是一组用户(贡献者),他们为一个或多个项目做出贡献。

您总是将代码作为单个用户提交/推送,而不是作为一个组织(或组),除非每个人共享相同的贡献者帐户(为什么你会做这样的事情?):那样,没有提交/推送的问题,对于github而言,用户(始终是用户,从不是组织)。

此外,请记住,提交/推送是git概念,而组织是github one

答案 1 :(得分:0)

尽管是正确的,但您只能提交,因为单个GitHub确实提供了将其链接回组织的选项。

  

您可以通过添加一个代表   提交消息的预告片。归因于组织的承诺   在GitHub上包含一个代用徽章。

请参见https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-on-behalf-of-an-organization

答案 2 :(得分:0)

我能够这样做,

git config user.name "linksplatform"
git config user.email "linksplatformtechnologies@gmail.com"

git commit -m "Deploy to GitHub Pages: $SHA"

git push "https://linksplatform:$GITHUB_TOKEN@$REPOSITORY.git" gh-pages

linksplatform是我的team's organization的名字。 linksplatformtechnologies@gmail.com是在组织资料中设置的公共电子邮件。我还使用GitHub Actions获取访问令牌并将其设置为$GITHUB_TOKEN变量。使用可以查看commit example来查看外观。