How can I use Git locally?
Just make a local git project and dont push it. You can do it later. Or you make a empty github project and pull the empty project. Now you can work locally and if you are ready you can push it to github.
No worry, just try.
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.
Actually you just have to run
git init
on your local folder. This will already create you a repository within the existing folder as a minimal setup.
If you would like to have a setup more similar to a distributed setup with a repository at some other place/server, use
git init --bare your_project.git
to create a repository (similar to the server side repository), and
git clone <path_to_repository>
in the local folder where you would like to work
A remote server is never required. You can just do git init
in your project. If you decide to add a remote server later, it will maintain all the history when you push it.
Also if you want you can use Bitbucket or GitLab. Both of them allow private repositories for free.