Skip to content
Discussion options

You must be logged in to vote

This issue usually happens when:

  • You have not created any commit yet
  • Your current branch is named master instead of main
  • You are trying to push a branch that does not exist locally
  • Git repository was initialized but no files were added or committed

Step 1: Check Your Current Branch

Run:

git branch

If you see:

* master

then your branch name is master, not main.

If you see:

* main

then your branch name is already main.


Step 2: Check Git Status

Run:

git status

If Git shows untracked files, you need to add and commit them first.

Example:

Untracked files:
  index.html
  style.css

Step 3: Add Files

Run:

git add .

This adds all files to the staging area.


Step 4: Commit Files

Run:

git commi…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies

This comment was marked as spam.

@hamzaaliaf
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GitHub or a GitHub feature is not working as intended Issues Repository issues let you track features, problems, and more alongside your code source:ui Discussions created via Community GitHub templates
2 participants