Git:- git add – not working

Background

I have had to rework one of our git repositories.

Git Commands

 

Git Add

I issued git add commands a few times, but “No Go“.

The syntax and sample is shown below.

Syntax


git add <sub-directory>/<file>

Sample


git add v2.14.1/compile.cmd

TroubleShooting

Folder Structure

Finally, I checked the sub-folder that I was trying to add files from.

And, behold there is a .git folder within the targeted sub-folder.

Image

Here is an image of the directory structure showing the .git folder.

Remediation

Please rename the .git folder underneath the target of your git add <folder><file> command.

Images

Image – Directory – .git renamed as .gittxt

Here is an image of the directory structure showing the .git folder renamed as .gittxt.

Git Commands

Git Add

Went back and issued the git add commands.

Git Status

Issue “git status” to confirm the files have been added.

Images

Image – git – git status – files successfully added

Summary

Rearranging folders and files is never quite as done as you think you are.

But, worth it, as it shows you are thinking and doing something about your thoughts.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s