Simple Github commit not working (trying to add an image to my public image folder)
-
28-04-2021 - |
Question
So i'm trying to do something i know is simple but its causing me some headaches. I am just trying to get an image from my app (im using MacFusion to ssh to our app vs having it on my machine locally). I basically dragged an image into the public/images folder along w/ some other html/css changes & then committed everything using git commit -a -m "comment about my commit here"...
I then pushed to github
So i thought that wouldve automatically added the image to the public/images folder in github (& on our server), but it didn't. all the other html & style changes went through but the image didn't show up in the public/images folder when i look in github.
I"m sure this is something dumb i'm overlooking but could really use a quick reason this is happening & instruction on how to get that one image file to the public/images folder in github.
thanks so much
Solution
It sounds like the file is currently untracked by Git!
You must first add the file for git to track it. i.e.
git add filename.jpg
Two useful commands include:
To list all files currently tracked in this git repository, use:
git ls-files
To see if any files are currently untracked in your current directory, simply run
git status
A pretty good cheatsheat of git commands can be found here: https://github.com/AlexZeitler/gitcheatsheet/blob/master/gitcheatsheet.pdf
OTHER TIPS
git commit -a
doesn't add new files. It just commits changes to already tracked file.
Try doing a git add .
.Or add the files explicitly and commit and push.
Use git status to see whether the files were added or not.