From the course: Visual Studio: Source Control with Git and GitHub

Clone the repo: PowerShell - Visual Studio Tutorial

From the course: Visual Studio: Source Control with Git and GitHub

Start my 1-month free trial

Clone the repo: PowerShell

- [Instructor] I will use PowerShell to clone a GitHub repository to my local computer. Before I show you the commands, let's look at what I've changed in this folder. Originally all the files were in this Command folder, and I've moved them into a sub-folder called Repo-Original. You can see them there. And the reason I moved them is I'm going to clone the repository into this Command folder, and I don't want to mix the two GitHub repos together. So I'm going to have a separate child folder here. Next step is to go get the URL from GitHub. I will be working with some of my repositories, so I'll look in here. And rather than use the one that I created with the static files, let's use the one that I created from Visual Studio. That was called WorkingWithGit. This is the solution we'll be working with. And I'll choose to Clone or Download, then copy the URL, and then switch back to PowerShell. Type in git clone, then paste in the URL, and hit enter. And you see it's cloning. I get some status information here. Enumerating objects, counting objects, compressing objects, total summary here. And then in File Explorer, I see that it added the sub-directory, and if I drill down into there, I see the solution file. So let's think about what's happened. I didn't have this project file on my local computer, and when I cloned it, I got all of the files as they currently sit in the current branch, plus I get all of my history for git, here in this .git folder. One more thing to look at before I close this video. Let's go over to the command line and switch to the sub-folder, and then do a git remote show. And this will tell me all the names of the remote repositories, and I only have one called origin. So now that I know the name, I can say show origin, and that'll list the details about this repository, what git knows about this repository. And I see that's it's got that remote origin, and it's using the URLs from the GitHub project. So what you take away from this, is that by cloning it from GitHub, we automatically set origin back to GitHub.

Contents