`fatal: Not a valid object name: 'master'` when creating a new branch in git

git

Solution

To create a git repository locally, you have to be inside the project directory, then run `git init` command.

To add a file to git, you have to create a file, with some text editor for example. Then you have to add that file to git, then commit it locally.

git add .

git commit -m "A short description what you did to the file"

UPDATED based on the question update :

To create a git repository for a project

- First you have to create a project directory.

- Then from inside the directory, you have to issue `git init` to initialize a git repo for that project

- By default, you will be in master branch, to create another branch, use `git branch <new branch name>`

To add new files to the created repository

- Create new files like you create for a project.

- Add those file to git using `git add .`

- To commit the file, use `git commit -m "a Short description about the action you performed"`

Problem

I followed this tutorial but I'm having trouble creating a new branch in a new repository. This is the error I'm getting: What am I doing wrong?

Original source

Related problems