Nothing to commit, working tree clean

Hello!

I’m just starting using Git and GitHub so please be patient with me as I really want to learn :slight_smile:

So the problem is: my local and remote depository has been already linked. My first commit is also visble here, on GitHub but I can’t push any new commits. This is what I get:

$ git commit -m “version 1”
On branch master
Your branch is up to date with ‘origin/master’.
nothing to commit, working tree clean

I tried to look for the answer online but it doesn’t seem to help me.

1 Like

@joanna89polska if you need to push your commits up to GitHub you can use the following command:

git push origin master

In this command origin refers to the URL of the repository on GitHub, and master is the current branch of your repository that you are wanting to push to.

I’d also recommend checking out GitHub Desktop – it’s a GUI application that we specifically built to help make it easier to use Git and GitHub. You can download it at http://desktop.github.com. Let me know if you have any other questions!

4 Likes

hello steveward 

im facing the same issue before  ‘git push origin master’

 i’m getting 

‘On branch master
nothing to commit, working tree clean’

on ‘git commit -m “add”’

Please let me know where i’m lagging!

Thankyou!

1 Like

Make new repo and push the existing code again to the new repo

git init doesn’t initialize if you already have a .git/ folder in your repository. So, for your case, do -

(1) rm -rf .git/

(2) git init

(3) git remote add origin https://repository.remote.url

(4) git commit -m “Commit message”

(5) git push -f origin master

Note that all git configs like remote repositories for this repository are cleared in step 1. So, you have to setup all remote repository URLs again.

Also, take care of the -f in step 5 : The remote already has some code base with n commits, and you’re trying to make all those changes into a single commit. So, force-pushing the changes to remote is necessary.

6 Likes

This worked for me. Thanks a lot

It worked for me ,Thankyou

Thanks, it helps. Your tips really solved my problem

Thanks a lot! That worked