Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: Git remote

Login or purchase this course to watch this video and the rest of the course contents.
0:01 So far we've only been working with our local Git repository with these commands. But Git is known as a distributed version control system
0:08 the word distributed is important, because with each Git repository we get not only the current version of the Git repository,
0:15 we get ever single change that has ever been made in that repository, the setup is different than earlier version control systems
0:22 where you had to check files in and out of the central repository, now with Git, we can share and sync up remote Git repositories with each other.
0:31 That is where the "git remote" command comes in. The "git remote" command allows us to control and specify the remote repositories
0:39 that we want our local Git repository to work with. We added the resources.markdown file to the staging area
0:48 and then committed it to our local Git repository. Next, we'll use the "git remote" command to specify which repositories
0:55 not hosted on our local system we want to sync up with, whether that is pulling down files from them or pushing changes to them.
1:02 Remember, we cloned this repository from GitHub using the "git clone" command,
1:06 so there is already a Git remote repository associated with this repository, if we type the "git remote" command we'll see that there is one
1:14 but that doesn't give us a lot of context for what origin is, I always use the "git remote command" with the "-v" option, this is for verbose.
1:23 "-v" describes not only the name of the other repositories, but also the URL where that repository lives,
1:30 what happens if we use the "git init" command, to create a new Git repository and don't have any remote repositories,
1:36 we can clear our way, existing remote repositories, with the "git remote remove" command.
1:41 Now when we type in "get remote -v", we'll see that there is nothing there, but we actually wanted origin as a remote repository,
1:47 so we can add it back in, "git remote add" and then the name of the other repository and then the URL for that repository.
1:57 Now again, "git remote -v" and we'll see we have origin back as a remote repository.
2:03 And we can absolutely have more than one Git remote repository at a time so we could say personal server and then add a URL
2:13 that is along with our personal server. So for example I could have a git.matmakai.com and we can say "course-demos" for that.
2:21 Then when we type "git remote -v", we'll see we both have origin which is for GitHub and personal server, that's the "git remote" command,
2:29 used to specify other repositories that we want to sync our files and our file history and the commit history,
2:37 which contains all of the changes to our files over time. After setting remote Git repositories, we can then use other commands
2:44 such as "git pull" and "git push", to sync those changes.


Talk Python's Mastodon Michael Kennedy's Mastodon