Why is this not working?
Git is telling you why, your question suggests that you have not read the error message that it is providing you.
If you have read it, then you'll have to elaborate on what it is you're trying to do and why you think it should work and what thoughts you have on the error message.
You've got one explanation so you'll have to explain what's missing in it if you're to ask for another!
I read it but I have tried committing it and it won't allow me to commit
And it tells you why you may not commit it, doesn't it?
That's not in your screenshot, but if it's not letting you commit, it'll be telling you why! Follow those error messages.
Okay.. did you read THAT error? It says there are no changes to commit.
Have you figured out what you want to be doing with the file?
Git refuses to overwrite it because it isn't saved anywhere else that it knows of. What do you want to do about that file? You always have to keep in mind what it is you're trying to do otherwise you're just.. pulling levers with no intention and I don't think that gets you anywhere and if it does then it's by accident.
even when I change something and commit it I get the same error as before
But you didn't commit it did you? Git told you there is nothing to commit, right?
You've got an unsaved file. You need to save or discard. You still haven't said which of those you're trying to do! You said you're trying to commit, but as Git tells you, you haven't told Git what to commit "no changes added to commit"
If you want to save your changes, then you'll need to tell git that these are marked for commit, and then commit it.
If you want to discard it, simply delete the file.
You just have to decide on what you want to do.
My whole point here is that you have to decide what action you want to take. What do you intend? Nobody can tell you that. "Not working" is an insufficient problem description!
nevermind it works now
That's great. But the important part here is to understand what Git is saying and how to respond to it!