Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Retrieve User Name and Email Address from the Git Repo(Jgit API to Retrieve User Name and Email Address from the Git Repo)
Retrieve User Name and Email Address from the Git Repo [message #1853258] Fri, 24 June 2022 06:55 Go to next message
Eclipse UserFriend
Hi Team,

I want to retrieve the User Name & Email Address for a given Git Repository using Jgit API.

Example Code snippet:

Git gitRepo = Git.open(new File("C:\\TestRepo\\"));
PersonIdent personIdent = new PersonIdent(gitRepo.getRepository());
String repoUserName = personIdent.getName();
String repoUserEmailAddr = personIdent.getEmailAddress();

When I execute this code, I always get the Email Address of the Organization of the System which I am logged in. I think it always reads the git config on the local machine and fetches the User Name and Email Address.

So is there any possibility (Jgit API/ REST API), where I can get the actual User Name and the Email Address of the user of the Remote GitHub Repository?

Any help regards to this is highly appreciated.

Thanks & Regards,
M Pratap

[Updated on: Fri, 24 June 2022 07:09] by Moderator

Re: Retrieve User Name and Email Address from the Git Repo [message #1853261 is a reply to message #1853258] Fri, 24 June 2022 08:53 Go to previous messageGo to next message
Eclipse UserFriend
Not via JGit. You have to use the GitHub REST API for that. See GitHub's REST API documentation.
Re: Retrieve User Name and Email Address from the Git Repo [message #1853266 is a reply to message #1853261] Fri, 24 June 2022 10:01 Go to previous messageGo to next message
Eclipse UserFriend
PersonIdent is used to store/read the author and committer of a git commit.
Re: Retrieve User Name and Email Address from the Git Repo [message #1853298 is a reply to message #1853261] Mon, 27 June 2022 03:18 Go to previous messageGo to next message
Eclipse UserFriend
Ok, thank you,
Re: Retrieve User Name and Email Address from the Git Repo [message #1853299 is a reply to message #1853261] Mon, 27 June 2022 03:19 Go to previous message
Eclipse UserFriend
Thank you.
Previous Topic:How to get User info from personal access token
Next Topic:Modify author date in JGit
Goto Forum:
  


Current Time: Tue May 20 03:24:35 EDT 2025

Powered by FUDForum. Page generated in 0.04916 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top