Querying the existing configuration
In this example, we will look at how we can query the existing configuration and set the configuration values.
Getting ready
We'll use jgit
again by using the following command:
$ cd jgit
How to do it...
You can use git config
to query your local and global Git configuration. In this section, we will show a couple of examples.
- To view all the effective configurations for the current Git repository, run the following command:
$ git config --listuser.name=John Doe[email protected]core.repositoryformatversion=0core.filemode=falsecore.bare=falsecore.logallrefupdates=trueremote.origin.url=https://git.eclipse.org/r/jgit/jgitremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*branch.master.remote=originbranch.master.merge=refs/heads/master
The previous output will, of course, reflect the user running the command. Instead of John Doe
as the name and the email, the output should reflect your settings.
- If we are just interested in a single configuration...