Copying a GitHub Repository to Your Local Computer

Data School · Beginner ·🖊️ Copywriting & Content Strategy ·12y ago

Key Takeaways

The video demonstrates how to copy a GitHub repository to a local computer using the git clone command, and explains how to set up remotes and verify the cloning process.

Full Transcript

in this video we're going to copy a GitHub repository to your local computer the process I'll show you will work for a repo you created yourself or a repo you forked from someone else for this demo I'm going to use the test repo that we created in the last video Let's Open up get bash this shows my working directory I'm going to change my working directory Tory to the desktop now we're ready to go note that all git commands start with the word git and then the name of the command and then usually one or more arguments in this case we're going to use the git clone command to clone a GitHub repo you simply type git clone and then the URL of the repo how do you get that URL I recommend that you go to the repo scroll down here and click the copy button now go back to get bash and at least in Windows you can hit the insert button on your keyboard to paste it the usual paste keyboard shortcut doesn't seem to work in git bash if all else fails just paste the URL somewhere else and retype it if you're following along at home you should hit enter at this point I'm actually going to change my URL because I use SSH instead of https to communicate with GitHub I now hit enter and it asked me for my password when typing it won't show you anything hit enter when you're done and if you type the wrong password just try again the cloning operation is now complete it's copied the repo into a subdirectory of my working directory and that subdirectory has the same name as the repo so I can just CD into to test repo and LS to see the list of files notice that it now says master that indicates that I'm now in a folder that is being tracked by git and I'm currently working on the master Branch I don't need to run the git init command because git has already been initialized in the folder on Windows if you're setup to show hidden files you can also see this.get folder where all the git information is stored next let's check on your remotes remotes are simply references to repos that are not on your computer to see your remotes type git remote- V you'll see a remote called origin which links to your repo this reference was automatically created during the cloning process if you don't have an origin remote you can add one by typing get remote add origin and then the URL of your repo the same one from here we've now cloned the repo and set up remote in the next video we'll actually make some changes locally commit them and then push them up to GitHub

Original Description

This is video #7 in the Data School series, "Introduction to Git and GitHub." Relevant links, a command list, and the full transcript are below. Playlist: http://www.youtube.com/playlist?list=PL5-da3qGB5IBLMp7LtN8Nc3Efd4hJq0kD == LET'S CONNECT! == Blog: http://www.dataschool.io Newsletter: http://www.dataschool.io/subscribe/ Twitter: https://twitter.com/justmarkham GitHub: https://github.com/justmarkham == LINKS RELATED TO THIS VIDEO == Cloning a Repo: http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository Adding a Remote: https://help.github.com/articles/adding-a-remote Working with Remotes: http://git-scm.com/book/en/Git-Basics-Working-with-Remotes SSH vs HTTPS: https://help.github.com/articles/which-remote-url-should-i-use == COMMAND LIST == clone repo: git clone [URL] check remotes: git remote -v add origin: git remote add origin [URL] initialize git: git init change directory: cd list files: ls == TRANSCRIPT == In this video, we're going to copy a GitHub repository to your local computer. The process I'll show you will work for a repo you created yourself or a repo you forked from someone else. For this demo, I'm going to use the "test-repo" that we created in the last video. Let's open up Git Bash. This shows my working directory. I'm going to change my working directory to the Desktop. Now we're ready to go. Note that all git commands start with the word "git", and then the name of the command, and then usually one or more arguments. In this case, we're going to use the "git clone" command to clone a GitHub repo. You simply type "git clone" and then the URL of the repo. How do you get that URL? I recommend that you go to the repo, scroll down here, and click the "Copy" button. Now go back to Git Bash, and at least in Windows, you can hit the "Insert" button on your keyboard to paste it. (The usual paste keyboard shortcut doesn't seem to work in Git Bash.) If all else fails, just paste the URL somewhere else and retype it. If you're followi
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Data School · Data School · 5 of 60

1 Setting up Git and GitHub
Setting up Git and GitHub
Data School
2 Navigating a GitHub Repository - Part 1
Navigating a GitHub Repository - Part 1
Data School
3 Forking a GitHub Repository
Forking a GitHub Repository
Data School
4 Creating a New GitHub Repository
Creating a New GitHub Repository
Data School
Copying a GitHub Repository to Your Local Computer
Copying a GitHub Repository to Your Local Computer
Data School
6 Committing Changes in Git and Pushing to a GitHub Repository
Committing Changes in Git and Pushing to a GitHub Repository
Data School
7 Syncing Your GitHub Fork
Syncing Your GitHub Fork
Data School
8 Allstate Purchase Prediction Challenge on Kaggle
Allstate Purchase Prediction Challenge on Kaggle
Data School
9 Troubleshooting: Updates Rejected When Pushing to GitHub
Troubleshooting: Updates Rejected When Pushing to GitHub
Data School
10 Hands-on dplyr tutorial for faster data manipulation in R
Hands-on dplyr tutorial for faster data manipulation in R
Data School
11 ROC Curves and Area Under the Curve (AUC) Explained
ROC Curves and Area Under the Curve (AUC) Explained
Data School
12 Going deeper with dplyr: New features in 0.3 and 0.4 (tutorial)
Going deeper with dplyr: New features in 0.3 and 0.4 (tutorial)
Data School
13 What is machine learning, and how does it work?
What is machine learning, and how does it work?
Data School
14 Setting up Python for machine learning: scikit-learn and Jupyter Notebook
Setting up Python for machine learning: scikit-learn and Jupyter Notebook
Data School
15 Getting started in scikit-learn with the famous iris dataset
Getting started in scikit-learn with the famous iris dataset
Data School
16 Training a machine learning model with scikit-learn
Training a machine learning model with scikit-learn
Data School
17 Comparing machine learning models in scikit-learn
Comparing machine learning models in scikit-learn
Data School
18 Data science in Python: pandas, seaborn, scikit-learn
Data science in Python: pandas, seaborn, scikit-learn
Data School
19 Selecting the best model in scikit-learn using cross-validation
Selecting the best model in scikit-learn using cross-validation
Data School
20 How to find the best model parameters in scikit-learn
How to find the best model parameters in scikit-learn
Data School
21 How to evaluate a classifier in scikit-learn
How to evaluate a classifier in scikit-learn
Data School
22 What is pandas? (Introduction to the Q&A series)
What is pandas? (Introduction to the Q&A series)
Data School
23 How do I read a tabular data file into pandas?
How do I read a tabular data file into pandas?
Data School
24 How do I select a pandas Series from a DataFrame?
How do I select a pandas Series from a DataFrame?
Data School
25 Why do some pandas commands end with parentheses (and others don't)?
Why do some pandas commands end with parentheses (and others don't)?
Data School
26 How do I rename columns in a pandas DataFrame?
How do I rename columns in a pandas DataFrame?
Data School
27 How do I remove columns from a pandas DataFrame?
How do I remove columns from a pandas DataFrame?
Data School
28 How do I sort a pandas DataFrame or a Series?
How do I sort a pandas DataFrame or a Series?
Data School
29 How do I filter rows of a pandas DataFrame by column value?
How do I filter rows of a pandas DataFrame by column value?
Data School
30 How do I apply multiple filter criteria to a pandas DataFrame?
How do I apply multiple filter criteria to a pandas DataFrame?
Data School
31 Your pandas questions answered!
Your pandas questions answered!
Data School
32 How do I use the "axis" parameter in pandas?
How do I use the "axis" parameter in pandas?
Data School
33 How do I use string methods in pandas?
How do I use string methods in pandas?
Data School
34 How do I change the data type of a pandas Series?
How do I change the data type of a pandas Series?
Data School
35 When should I use a "groupby" in pandas?
When should I use a "groupby" in pandas?
Data School
36 How do I explore a pandas Series?
How do I explore a pandas Series?
Data School
37 How do I handle missing values in pandas?
How do I handle missing values in pandas?
Data School
38 What do I need to know about the pandas index? (Part 1)
What do I need to know about the pandas index? (Part 1)
Data School
39 What do I need to know about the pandas index? (Part 2)
What do I need to know about the pandas index? (Part 2)
Data School
40 How do I select multiple rows and columns from a pandas DataFrame?
How do I select multiple rows and columns from a pandas DataFrame?
Data School
41 Machine Learning with Text in scikit-learn (PyCon 2016)
Machine Learning with Text in scikit-learn (PyCon 2016)
Data School
42 When should I use the "inplace" parameter in pandas?
When should I use the "inplace" parameter in pandas?
Data School
43 How do I make my pandas DataFrame smaller and faster?
How do I make my pandas DataFrame smaller and faster?
Data School
44 How do I use pandas with scikit-learn to create Kaggle submissions?
How do I use pandas with scikit-learn to create Kaggle submissions?
Data School
45 More of your pandas questions answered!
More of your pandas questions answered!
Data School
46 How do I create dummy variables in pandas?
How do I create dummy variables in pandas?
Data School
47 How do I work with dates and times in pandas?
How do I work with dates and times in pandas?
Data School
48 How do I find and remove duplicate rows in pandas?
How do I find and remove duplicate rows in pandas?
Data School
49 How do I avoid a SettingWithCopyWarning in pandas?
How do I avoid a SettingWithCopyWarning in pandas?
Data School
50 How do I change display options in pandas?
How do I change display options in pandas?
Data School
51 How do I create a pandas DataFrame from another object?
How do I create a pandas DataFrame from another object?
Data School
52 How do I apply a function to a pandas Series or DataFrame?
How do I apply a function to a pandas Series or DataFrame?
Data School
53 Getting started with machine learning in Python (webcast)
Getting started with machine learning in Python (webcast)
Data School
54 Q&A about Machine Learning with Text (online course)
Q&A about Machine Learning with Text (online course)
Data School
55 Your pandas questions answered! (webcast)
Your pandas questions answered! (webcast)
Data School
56 Machine Learning with Text in scikit-learn (PyData DC 2016)
Machine Learning with Text in scikit-learn (PyData DC 2016)
Data School
57 Write Pythonic Code for Better Data Science (webcast)
Write Pythonic Code for Better Data Science (webcast)
Data School
58 Web scraping in Python (Part 1): Getting started
Web scraping in Python (Part 1): Getting started
Data School
59 Web scraping in Python (Part 2): Parsing HTML with Beautiful Soup
Web scraping in Python (Part 2): Parsing HTML with Beautiful Soup
Data School
60 Web scraping in Python (Part 3): Building a dataset
Web scraping in Python (Part 3): Building a dataset
Data School

This video teaches how to copy a GitHub repository to a local computer and set up remotes, which is a fundamental skill for collaborating on code and tracking changes.

Key Takeaways
  1. Open Git Bash and change the working directory to the desired location
  2. Use the git clone command to clone a GitHub repository
  3. Paste the URL of the repository into the command line
  4. Enter the password when prompted
  5. Verify the cloning process by checking the files and remotes
  6. Use the git remote -v command to check the remotes
  7. Add a remote if necessary using the git remote add origin command
💡 The git clone command automatically creates a remote called origin, which links to the original repository on GitHub.

Related AI Lessons

Up next
The Sales Formula That Changed Everything
The Payrollin' Podcast
Watch →