Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Git locally?

I'm working on a project at the moment, which I'd like to eventually make public on github, but, for the moment, needs to remain private.

Github needs users to pay in order to host a private repository, which I'm unwilling to do, so just creating a private github repository is not an option for me.

However, I would still like to use git for version tracking etc. whilst I'm working on the project locally, so that when I do eventually put the project on github, all of this information, the project's changes start-to-finish, will be available.

But, I have no clue how to use git without a remote server. I'm wondering now if it just exactly the same, simply without the need for git push.

The perfect answer for me would be a step-by-step walkthrough, telling me exactly what I should type into the terminal to set up and maintain a local git repository.

like image 552
theonlygusti Avatar asked Sep 25 '22 04:09

theonlygusti


People also ask

Is it possible to use git locally?

Git allows you to create a local repository on your machine. Only when you're actually ready to publish it to a remote is when it becomes available to the public.

Can I use git without Internet?

No, an internet connection is not required. You can use Git entirely locally with no network connection. It can be used for a single repository, in which no network connection is used.

Can you use git without a server?

Git will work happily without a central server, although many teams find it convenient to have a central repository. If by "server", you mean "install server software", git will also work (central repository or not) without any special software, through ssh or on the file system.


1 Answers

You only need to push if you want to use a remote server.

When working locally, you still need to git init to set up the repository, but after that you only need to do the steps

git add
git commit -m "new commit"

to save ("commit") your changes.

Don't git push at all, and don't git pull — there's no remote to sync changes with (git push and git pull just push and pull changes from the remote/online repository).

Type:

git log

To see that your changes have been recorded.

like image 34
rikard Avatar answered Oct 16 '22 06:10

rikard