I'm using Github Desktop and tried pushing a new project into a React_Native repository, however when I try committing the code I'm prompted with "cannot add to the index - missing --add option?", I noticed that this problem occurs after I run "expo init client" to initiate my program. Any help is greatly appreciated.
I had the same problem.
What fixed it for me was I went into the folder using file explorer. Under the view tab, I checked the hidden items box. Then I deleted the .git file.
edit: see @opcode's comment.
I was very silly and hadn't committed the file yet. Git has to be tracking it first so the files you apply this to can't be new, must be committed first
there's a another .git folder nested inside your project. Go and delete that folder to make it work.
Look at the first error first, that's likely what's causing the other ones. It's saying that that directory (John_Deere/client/
) was not found. That path probably doesn't exist any morel maybe you moved some folders around or something? Try adjusting the expected path and see if that works.
In my case (same error), i had php container running, with project folder connected as volume to my local storage. Previously I created git repo inside this project folder and this action left some hidden files inside. In my case even 'empty' folder resulted in this error occuring (as i presume due to hidden files still being present). Still not 100% sure what did the trick for me but my guess is on deleting hidden '.git' file (in my case from container cli)
I agree that checking the folder for hidden files - or oddly named files - is a good start to troubleshooting this problem.
Alternatively, you could create a new folder in the destination repository and copy over the specific files you want there - that will likely address the issue for you, too.
this happened to me when i cloned another git to a new one . removing the .git from the cloned folder helped me.
In my opinion this happens because Github Desktop couldn't add files to staging area automatically, and that's is the reason why you have to do it by yourself.
Using terminal navigate to your project directory (in VS Code you open terminal using CTRL + `
. Inside your project directory run git add .
After this you can commit using Desktop Github as you usually do or of course you can commit using terminal git commit -m "your commit message"
.
© 2022 - 2024 — McMap. All rights reserved.