In this tutorial I will show you how to create a git repository from scratch.
Create a Hello World Program
Starting in the empty working directory, create an empty directory named “HelloWorld”, then create a file named hello.txt with some random content.
mkdir HelloWorld cd HelloWorld notepad.exe hello.txt
Add “Hello, World” to this text file and save the contents.
Create the Repository
You now have a directory with a single file. To create a git repository from that directory, run the
git init command.
Add the Text file to the Repository
Now you can add the hello.txt file to the repository.
git add hello.txt git commit -m "First commit"
Now, you have a git repository with your single file commited to it.
All posts in this series:
– Lab 1: Setup Git on your Machine
– Lab 2: Create a Git Repository from Scratch
– Lab 3: Check the Status of the Repository
– Lab 4: Making Changes to files in the Working Directory
– Lab 5: Staging Changes in Git
– Lab 6: Git Staging and Commiting
Other related posts:
– Git Delete a Local or Remote Branch
– How to Clone a Git Repository into a Specific Folder?
– Change the URI for a Remote Git Repository
– How to Merge a Local Git Branch with Master
– How to Setup Aliases and Shortcuts for Git Commands
– How to create a .gitignore file in Windows
This content has been helpful to you?
Thanks for contributing!