Creating a local repository with Git CLI

Now that we have the Git binaries installed, let's take a step forward and create our first local Git repository.

Getting ready


Make sure that you have installed Git.

How to do it…

We will take a common path by starting a new pet project, where we will simply create a new local directory, add some files to it, and then realize, Ohh I am gonna need a version control system:

  1. So, yes, quickly create your new project:
    $ mkdir mynewproject
    $ touch mynewproject /index.html
    $ touch mynewproject /main.js
    $ touch mynewproject/main.css
    
  2. Add some sample content to these files by editing them:

    Now you need to create a Git repository for this project. Sure, Git covered you with the git init command.

  3. Make sure you are in the ...

Get Ubuntu Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.