馃攳
Copying a GitHub Repository to Your Local Computer - YouTube
Channel: unknown
[0]
In this video, we're going to copy a GitHub
repository to your local computer. The process
[6]
I'll show you will work for a repo you created
yourself or a repo you forked from someone
[12]
else. For this demo, I'm going to use the
"test-repo" that we created in the last video.
[19]
Let's open up Git Bash. This shows my working
directory. I'm going to change my working
[29]
directory to the Desktop.
[36]
Now we're ready to go. Note that all git commands
start with the word "git", and then the name
[43]
of the command, and then usually one or more
arguments. In this case, we're going to use
[49]
the "git clone" command to clone a GitHub
repo.
[54]
You simply type "git clone" and then the URL
of the repo. How do you get that URL? I recommend
[63]
that you go to the repo, scroll down here,
and click the "Copy" button. Now go back to
[73]
Git Bash, and at least in Windows, you can
hit the "Insert" button on your keyboard to
[80]
paste it. (The usual paste keyboard shortcut
doesn't seem to work in Git Bash.) If all
[87]
else fails, just paste the URL somewhere else
and retype it.
[92]
If you're following along at home, you should
hit "Enter" at this point. I'm actually going
[97]
to change my URL because I use SSH instead
of HTTPS to communicate with GitHub.
[109]
I now hit Enter, and it asks me for my password.
When typing, it won't show you anything. Hit
[122]
Enter when you're done, and if you typed the
wrong password, just try again.
[136]
The cloning operation is now complete. It
has copied the repo into a subdirectory of
[141]
my working directory, and that subdirectory
has the same name as the repo. So, I can just
[149]
"cd" into "test-repo" and "ls" to see the
list of files.
[159]
Notice that it now says "master". That indicates
that I'm now in a folder that is being tracked
[166]
by Git, and I'm currently working on the "master"
branch. I don't need to run the "git init"
[173]
command, because git has already been initialized
in the folder. On Windows, if you're set up
[179]
to show hidden files, you can also see this
".git" folder where all of the Git information
[189]
is stored.
[192]
Next, let's check on your "remotes". Remotes
are simply references to repos that are not
[200]
on your computer. To see your remotes, type
"git remote -v". You'll see a remote called
[209]
"origin", which links to your repo. This reference
was automatically created during the cloning
[215]
process.
[217]
If you don't have an origin remote, you can
add one by typing "git remote add origin"
[227]
and then the URL of your repo. The same one from here.
[237]
We've now cloned the repo and set up a remote.
In the next video, we'll actually make some
[242]
changes locally, commit them, and then push
them up to GitHub.
Most Recent Videos:
You can go back to the homepage right here: Homepage





