accidentally created extra .git folder and now can't access js folder in github

122 Views Asked by At

I see the js folder in GitHub but unlike my css folder the js folder icon has 2 folders instead of one like the others. It should only have the main.js file in it, not another folder.

Also, I can't access the folder because folder title js is not a link and main.js is not even listed in the file finder.

Looking through terminal I see that there is a .git folder inside the js folder. The project folder has a .git folder in it as well.

I'm following a tutorial and when the tutorial instructed to stage and push the code to my GitHub repo, I accidentally did that from inside the js folder at first, then I did it again from the main project folder. I'm pretty sure this is where something went wrong.

How do I fix this? I'm assuming remove the .git folder inside the js folder but not sure how to do that and also scared that everything might get deleted.

Thanks in advance! I'm a beginner, please be patient with me :)

1

There are 1 best solutions below

0
On

Removing the .git folder will work. The command is simple rm -rf .git. But if you don't have idea how to use it, better to follow below method. Otherwise there is a chance to remove the other folder unkwnowingly

Use pwd command to get the present working directory. Let's say your project folder is : /home/tina/workspace/myproject.

If so, use this command -
rm -fr /home/tina/workspace/myproject/jsfolderpath/.git . So that you can make sure the directory you are deleting is correct one.

Note:

  • rm => command to remove
  • f => run the command in force
  • r => run the command recursively