Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:55 Go to next message
Pratap Meka is currently offline Pratap MekaFriend
Messages: 9
Registered: June 2022
Junior Member
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 11:09]

Report message to a moderator

Re: Retrieve User Name and Email Address from the Git Repo [message #1853261 is a reply to message #1853258] Fri, 24 June 2022 12:53 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 508
Registered: August 2016
Senior Member
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 14:01 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1214
Registered: July 2009
Senior Member
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 07:18 Go to previous messageGo to next message
Pratap Meka is currently offline Pratap MekaFriend
Messages: 9
Registered: June 2022
Junior Member
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 07:19 Go to previous message
Pratap Meka is currently offline Pratap MekaFriend
Messages: 9
Registered: June 2022
Junior Member
Thank you.
Previous Topic:How to get User info from personal access token
Next Topic:Modify author date in JGit
Goto Forum:
  


Current Time: Sun Nov 27 03:25:00 GMT 2022

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

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

Back to the top