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,260 points
18,427 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,460 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, 2021 in Git & GitHub by MD
• 95,460 points
1,133 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,700 points
2,354 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,039 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,460 points
8,883 views
0 votes
1 answer

How to ignore an error on 'git pull' about my local changes would be overwritten by merge?

Hi Team, If you want to remove all ...READ MORE

answered Jan 5, 2021 in Git & GitHub by MD
• 95,460 points
3,083 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP