Cannot git add to staging

Hi there – I’m not quite sure what’s wrong with my terminal. I am working on “The Boredless Tourist” exercise in the Computer Science course: https://www.codecademy.com/paths/computer-science/tracks/cspath-cumulative-tourism/modules/cspath-boredless-tourist/projects/the-boredless-tourist

Starting from a new project, I have:
In terminal
git init
Initialized empty Git repository in /home
tourist/.git
git add script.py
git commit -m "initial commit"
[master (root-commit) 4cee533 initial co
1 file changed, 0 insertions(+), 0 delet
create mode 100644 script.py
In script.py destinations = ['Paris, France', 'Shanghai, China', 'Los Angeles, USA', 'Sao Paulo, Brazil', 'Cairo, Egypt'] test_traveler = ['Erin Wilkes', 'Shanghai, China', ['historical site', 'art']]
In terminal
git add script.py
git commit -m "Added test objects"
On branch master
nothing to commit, working tree clean
git add script.py
git status
On branch master
nothing to commit, working tree clean

It looks like I can’t add script.py to my Git repository. Any idea how I can troubleshoot? Thanks!

git status shows un-comitted files.

use git log to see your commits

Yes, I can see my initial commit when I use git log, but when I try and git add the script.py file again (after populating and saving it), it won’t let me git commit that file to the repository.

and there is no second commit in the log? Do you get an error when attempting the second commit?

Did you press the save button to save the file? Its the only way i can replicate your issue

nope, no second commit. even after pressing save. the message I get when attempting the second commit is:
On branch master
nothing to commit, working tree clean

This happens every single time, even if I try resetting the project and initializing another git repository

can’t replicate issue:

i get the same error:

$ git status                                                                 
On branch master                                                             
nothing to commit, working tree clean  

but then i press the save button, and everything works.

you could try to edit the file in the command line using nano? type: nano script.py in the command line.

Huh, it looks like it works now! Maybe I was clicking save at the wrong time? Regardless, thank you so much for the help!!

you need to press save after making the changes to file :wink:

if save button ever bugs out, you can always use nano (a command line text-editor) to work around the problem (hopefully)

1 Like