Is it necessary to have an internet connection to use Git locally?

Samitha Neranjan Liyanage
2 min readJun 1, 2022

Actually no, no internet connection is required. Git is a distributed version control system that makes Git great.

So why is it so great? Because there is no central repo, you must have access to get work done. Even without internet access, you can commit, fork, and meet on your own repo on your local computer. Then, when you’ve connected again, you can push your changes to any other Git repository you have access to. So while most people think of a specific repository as a central repository (repository), this is a process choice, not a Git requirement.

Let me explain a little more about the problem. You can use Git entirely locally, no internet connection required. It can be used for a single repository where no network connection is used. It can be used to pull from other repositories on the same computer, just read from the filesystem, which doesn’t require a network connection. You can also use it with a LAN connection but no internet connection if you want to share between multiple machines but don’t have an internet connection. Or, if you don’t have a network at all, even a local network, you can store the repositories on removable media, move them between computers, and pull and push to storage on removable media on each machine library.

You may feel like this. If it doesn’t require an internet connection, then why I have to add a username and email address while setting up Git for the first?

Record names and email addresses to store author information for each commit. They are only used to identify who authored or committed each change. If you’ve ever worked on a project with more than one person, having author information is more informative. Email addresses aren’t actually used for anything other than identifying who made what mistakes. Two different people can choose the same username. Since an email address is a unique identifier that almost everyone already has, it’s a convenient way to choose a unique ID

In conclusion, I can say that you don’t need a remote repository at all.
You can have the full git experience, including committing, branching, merging, rebasing, and more, all with a local repository. The purpose of a remote repository (such as GitHub) is to publish your code to the world (or some people) and allow them to read or write it.

The remote repository is only involved when you git push your local commits to a remote repository, or when you git pull someone else's commits from it.

--

--

Samitha Neranjan Liyanage

I am an undergraduate student at the Unversity of Moratuwa.