Last active
September 17, 2017 16:08
-
-
Save programmerbrown/2475e526fc7bb1a7826d3810424bdda2 to your computer and use it in GitHub Desktop.
How I Fixed a .git within a .git Issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was going through a tutorial and had a project that had git repo initialized. | |
I added a project from a zip file that had its own .git and .gitignore file. This caused problems when I wanted to commit | |
changes to this file. the diagram below shows the representation | |
Diagram: | |
my_project | |
| | |
|----- .git | |
|----- .gitignore | |
| | |
------ new_directory | |
| | |
|-------- .git | |
--------- .gitignore | |
How I fixed this issue: | |
1. Delete the .git and .gitignore file from the new_directory | |
2. Navigate back to my_project. | |
3. Renamed new_directory to new_directory_x. | |
Side Note: If you try to add to the git stage the newly renamed new_directory_x then you will see the following error: | |
fatal: Unable to create '/Users/nick_x/software-projects/udemy-complete-angular-master-class/.git/index.lock': File exists. | |
If no other git process is currently running, this probably means a | |
git process crashed in this repository earlier. Make sure no other git | |
process is running and remove the file manually to continue. | |
4. Run the following command from the terminal: rm -f ./.git/index.lock | |
5. Now you can add and commit files from the new_directory_x to your git repository. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment