Check the folder first
Open a terminal inside the portfolio folder. Before running Git, confirm that the terminal points to the intended project. Initializing the wrong folder can make Git follow unrelated files.
git init
This command creates a hidden local Git repository for the current folder. It does not change the project files and does not create anything on GitHub.
Ask Git what it sees
git status
git status is the most useful beginner command. It tells you:
- the current branch;
- which files Git has never recorded;
- which tracked files changed;
- which changes are prepared for the next commit.
Run it before and after every new operation while learning.
Create the first visible situation
Add a line to index.html, save it, then run:
git status
Git reports the file, but it has not created a version yet. Git observes the difference and waits for your decision.
Identity is not a project version
On a new computer, Git may ask for your name and email before the first commit. Configure the identity that should appear in the history:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
This identifies the author of future commits on that computer. It does not sign in to GitHub.
What git init changed
After git init, GitHub still contains nothing and Git has not recorded a project version yet. The only change is that the current folder now contains a local Git repository ready to track versions.
What to remember
git init begins local history. git status explains the current situation. Read the situation before choosing the next command.