In an ideal world,
we would be working with a remote repository and we
would work in our local copy,
just as we did with our original repository that we cloned from GitHub.
Now of course we're not going to set up a new web‑based repository,
we're working on our single machine, but we can use a file‑based repository.
Now here in our first command,
we're creating a new directory structure for our
_____ commas server‑based repository.
I'm creating under a directory called git just to organize it,
but notice the extension, the directory has the extension .git.
We can move into that directory, and then we initialize our repository,
but we use the option ‑‑bare so we know that we're
not storing raw files in here, we're only storing the repository information.
The repository information has all of the
information for the files that we need.
Moving back to my project, I can go through and check on my configuration,
and there is no remote information.
We created this repository locally, and we've just been working locally,
but we now want to perhaps collaborate with others,
so we want to push it to a Git server.
Now in our case we're using the file protocol,
but we could quite easily use SSH or HTTPS,
but we can demonstrate this just using our ordinary file protocol.
So we use git remote, add our origin, so that's going to be our remote server,
and we're just putting a file system path rather than it being
prefaced with the protocol that we're using.
Now even though we're saying this is really for demonstration purposes,
we could use this if we actually had NFS shares through to our server.
The reality is we could access our repository through the file system,
so it's not as crazy as it seems.
For us, of course, this is just going to be a local file system.
We can verify the remote information that we've added,
and it should be available for both push,
and as it will say, fetch, but that's really our pulling of information.
The first time we run git push, we must set the upstream.
So we can set our upstream, and we can say then that that's going to be origin,
where we've added in our origin, and we can synchronize master through to that.
Subsequent pushes would only need git push,
we wouldn't need to add in the ‑‑set‑upstream.
Again, when we go through and take a look at our git config ‑‑list,
we're going to see that we've got added information now
relating to our remote master repository.
Having created our master repository,
we'll also see then that I can go through and clone it again,
just as we did with our original repository working with the comptia‑automation.
So we can see how collaboration really does work, albeit we're doing it on our local file system.