Git repository
We now have Git installed and set up to start working, it's now time to start working on project and using Git. For the exercises onward we will be working on a hypothetical university management system.
Create an empty directory named “university” in your user directory or any other location of your choice.
$ mkdir university
$ cd university
Create a file named index.html with below contents.
“<p>Welcome to the university</p>”
on linux you can do this with a single command
$ echo "<p>Welcome to the university</p>" > index.html
Git Repository
You can initialise a git repository in two ways:
- Initialise an existing local directory that is not under Git version control, and turn it into a Git repository.
- Retrieve an existing Git repository from a hosted location via URL
Initialise an existing local directory as Git repository
$ git init
You should see
Initialized empty Git repository in /home/user/university/.git/
Congratulations, you have your first local Git repository to build something amazing.
Previous Next