7

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?

automatix
  • 14,018
  • 26
  • 105
  • 230

3 Answers3

7

An organization is only a group of user (contributors) that contribute to one or more projects.

You always commit/push code as a single user, never as an organization (or group) unless everyone share same contributor account (why you would ever do such thing?): that way, no matter who commit/push, for github is the same user (always a user, never an organization).

Moreover remember that commit/push are git concept whereas organizations are github one

DonCallisto
  • 29,419
  • 9
  • 72
  • 100
  • Thank you very much for your answer! To your note about commit/push: Sure, commit and push a are Git concepts -- I only was speaking about commits (or actually pushes) to a GitHub repo (or actually repo hosted on GitHub) as it requires GitHub credentials. – automatix Mar 02 '16 at 12:01
  • This answer seems logical but it is not correct. Under some circumstances the organisation will appear as "commiter" while the author will always be derived from the git log entry. Unfortunateley this seems not well documented and I wonder if you have control over it as github user/organisation. See also the other answers. – mit Oct 10 '21 at 09:32
  • Maybe this is related? https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile I am not sure if these weird rules also apply also to "who is the commiter" - the organization or the user? – mit Oct 10 '21 at 09:55
4

I was able to do so, like this:

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

Where linksplatform is a name of my team's organization. And linksplatformtechnologies@gmail.com is its public email set in the organization's profile. I also used GitHub Actions to get access token and set it as $GITHUB_TOKEN variable. Use can check out the commit example to see how it looks.

Konard
  • 2,298
  • 28
  • 21
  • Thanks for your answer! Yes, I see, the message "linksplatform committed 2 days ago" on the commit page. But when I go to the commits list, commit `3e62984` (`3e62984b9fa5d4a0b0ab76783ec8250d3f5bf88a`) is not there. – automatix Nov 27 '19 at 15:19
  • @automatix here is the [commits list](https://github.com/linksplatform/Interfaces/commits/gh-pages). – Konard Nov 27 '19 at 17:45
2

Although it is correct you can only commit as an individual GitHub does offer the option to link it back to an organisation.

You can create commits on behalf of an organization by adding a trailer to the commit's message. Commits attributed to an organization include an on-behalf-of badge on GitHub.

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

John
  • 29,788
  • 18
  • 89
  • 130