error on branch master nothing to commit working directory clean when try to commit my changes

0 votes

I installed git in my Linux system. But whenever I tried to commit, It shows me  "On branch master nothing to commit, working directory clean".

What I am doing wrong?

Apr 10, 2020 in Git & GitHub by akhtar
• 38,180 points
5,154 views

1 answer to this question.

0 votes

Hi@akhtar,

 If you already have a .git/ folder in your repository git init doesn't initialize. So, follow the below given steps.

  • remove .git/ folder

$ rm -rf .git/
  • Initialize git folder again.

$ git init
  • Add remote url.

git remote add origin url
  • Now commit your changes.

git commit -m “Commit message”
  • Finally push in github.

git push -f origin master

Hope this will help you.

answered Apr 10, 2020 by MD
• 95,220 points

Related Questions In Git & GitHub

0 votes
0 answers
0 votes
1 answer

How to get changes from master branch to a new branch in Git?

Hi@akhtar, You need to check out the branch and ...READ MORE

answered Jan 4 in Git & GitHub by MD
• 95,220 points
112 views
0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,660 points
854 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,135 views
+2 votes
1 answer
0 votes
1 answer

error: Could not read error: unable to read tree object HEAD nothing to commit (working directory clean)

Hi@akhtar,  This kind of error may occur if ...READ MORE

answered Apr 10, 2020 in Git & GitHub by MD
• 95,220 points
2,384 views
0 votes
1 answer