Skip to content
Justice Tech School

Remotes: clone, push and pull

A remote is a copy of the repository somewhere else, usually named origin. git clone downloads one, git push uploads your commits and git pull fetches and merges new ones. The example uses a local folder as the remote.

Example
echo one > a.txt; git add .; git commit -q -m "one"
rm -rf ../remote.git ../clone && git init -q --bare -b main ../remote.git
git remote add origin ../remote.git
git push -q -u origin main
git clone -q ../remote.git ../clone
cat ../clone/a.txt
git remote -v | head -1 | cut -f1

Result

one
origin

Exercise

Upload commits.

git  origin main

Quiz Test

What does git clone do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.