Now, of course, there's a lot that we can do with Git, and we do have
configuration information that we can see. Making sure that we're working
within our Git repository or at least a subdirectory of that, we're able
then to use the git config ‑‑list, and this will show us all of the
configuration relating to the Git repository that we're currently working
in, as well as global configuration.
Our main configuration is going to be stored within the .git subdirectory
of our repository, but we also have global information.
If I try and list the global information,
it will be empty at the moment as we haven't set any of this.
The global information is stored within a .gitconfig
file within our home directory.
We can populate this without actually opening up the file by
going through and setting certain parameters.
The minimum parameters that we need to be able to save or
commit changes is a user email and a username.
The idea is then that we know who's made these changes, and, of
course, these become important in a version control system so we know
who were the instigators of certain changes.
Once we have then set these changes,
we can go through and list these, but it would also show in our standard
‑‑list command because all of our global configuration is going to be
included in the configuration for each repository.
So we need to set this basic information. And again, we can
move directly out to our command line,
seeing how we can configure our Git configuration.
So we can locate the information,
create our global configuration, and have our Git deployment up
and running for us to start properly using.
So welcome back to our command line.
You can see the directory that we're working in, so we know
we're going to have then our Git configuration.
If I go through and take a look at git config ‑‑list,
we can see then all of the configuration information,
including where our remote repository is located.
So when I want to push changes back or if I want to go
through and check for updates, so I've got git pull and git
push, pull to bring changes down,
push to push changes back, we know where to send those changes.
If I go through and clear out the screen and then go through
and take a look at my global settings,
global settings then apply to all repositories, and we can see then
that we're failing to read from our configuration file. So it quite
clearly shows where the file is, home/vagrant,
my user account, .gitconfig, but it's not there at the moment.
Now I could edit the file and put the values in, but it's easy to go through
and set the values. So let me go through and just change this from listing.
So we can go through into our ‑‑global, and we can then go through and set
our user.email, and we're going to go through and put tux@ and then
example.com, and we can go through and put our username. These are the
minimum configuration values that we need to be able to commit changes back
to our repositories.
As we said in the slides,
we have to be able to track who made the changes, so we can then go through
and put Tux and Penguin. And now that we've set that, if I go back and then
list the global configuration, now that works.
But if I go through and cat from my home directory the .gitconfig file,
we can see how that information is stored. But it's also
included in our repository information.
The global information, as the name suggests, it's global.
It's going to appear as we can see then within all of
our repositories. With that set,
we can then go ahead and start moving forward with Git so we can look at how we can start making changes.