Table of Contents

Clone a remote Repo

Clone Repo

Go into the directory, where you want to receive the directory of the repository to be cloned: To clone a repository from a remote to your local machine, use git clone:

$ git clone <repository-url>

The <repository-url> you can find in the browser bar of github or forgejo. Which will look something like this:

$ git clone http://192.168.178.86:3000/git-admin/homesite
---------------------------------------------------------
Cloning into 'homesite'...
remote: Enumerating objects: 139, done.
remote: Counting objects: 100% (139/139), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 139 (delta 38), reused 139 (delta 38), pack-reused 0
Receiving objects: 100% (139/139), 1.84 MiB | 41.92 MiB/s, done.
Resolving deltas: 100% (38/38), done.

This creates a new folder named after the repo (homesite) into your current working directory, containing the full project and its git history, already connected to the remote as origin.

After cloning

Change into the repo directory and you're ready to work with it. If you want to confirm the remote is set correctly, run git remote -v inside the folder — it should show origin pointing to the URL you cloned from.

$ cd homesite

$ git remote -v
---------------
origin	http://192.168.178.86:3000/git-admin/homesite (fetch)
origin	http://192.168.178.86:3000/git-admin/homesite (push)

Usefull alternatives

# Clone into a specific folder name
git clone <repository-url> my-folder-name

# Clone only a specific branch
git clone -b branch-name <repository-url>

# Shallow clone (only latest commit, faster for large repos)
git clone --depth 1 <repository-url>