0

enter image description hereI have created a project with git many years ago. But it doesn't contain all the files. Currently I would like to add all files of that project to git with a new account. But while trying to commit it says "The repository is locked" . After doing a research I found need to remove .git folder from project so I ran rm -f .git/index.lock. But unable to remove the existing git from project. How can I delete the existing git from project.

Edit

Iam able to delete the git folder now and create a new git. But two separate repositories are create (one for the project) and other for Pods. How to create a single repository for the whole project

Honey
  • 2,840
  • 11
  • 37
  • 71
  • If you do `ls -la` on the folder of your project, does `.git`, and `.gitignore` appearsN Light want to remove them. But you also could just change the target url of the project: https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository etc. You can open it in SourceTree or other app with GUI that allow you to modify the URLs, access, account, etc if you prefer. – Larme Dec 08 '20 at 10:09
  • @Larme If I do ls -la on the project folder I dont get .git and .gitignore – Honey Dec 08 '20 at 10:25
  • Say `git rev-parse --show-toplevel` to find the git folder. – matt Dec 08 '20 at 10:50
  • @matt It doesnt show any path of git folder when I do above – Honey Dec 08 '20 at 11:00
  • @Honey You don't have to worry about it, you are not going to commit the POD files. If you still want to please delete .git folders inside Pods directory. – Satheesh Dec 08 '20 at 13:27
  • @Satheesh Your suggestion helped me and I m able to use git now for my app. Thank you. – Honey Dec 09 '20 at 09:53
  • @Honey Glad it did, please accept my answer if you feel so. – Satheesh Dec 09 '20 at 10:25

1 Answers1

3

Best way is to remove git from the project and then re-initalize it.

rm -rf .git*

Then

git init
git add *
Satheesh
  • 10,998
  • 6
  • 50
  • 93
  • When I do rm -rf .git* I get the error zsh: no matches found: .git* in terminal – Honey Dec 08 '20 at 10:14
  • Try this find . | grep .git | xargs rm -rf – Satheesh Dec 08 '20 at 10:15
  • searches and shows "Operation not permitted" in terminal – Honey Dec 08 '20 at 10:18
  • Yes Am in current directory . xargs: unterminated quote is the error – Honey Dec 08 '20 at 10:22
  • can you just do rm -rf .git ? and tell me what is happening. – Satheesh Dec 08 '20 at 10:37
  • Nothing happens . – Honey Dec 08 '20 at 10:58
  • and when you do ls what is the output do you see the .git folder? – Satheesh Dec 08 '20 at 11:36
  • defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder I have used this to find hidden files of mac found here https://osxdaily.com/2009/02/25/show-hidden-files-in-os-x/ and able to delete .git file now. I have one more doubt . can u please clarify it . My project has appfiles along with pods. When I create new git repositories two separate remote repositories are created. How is it possible to make it as a single one as it belongs to single project only . – Honey Dec 08 '20 at 13:03
  • Please check the attached image in my question – Honey Dec 08 '20 at 13:10
  • Don't try the suggestion of "Try this find . | grep .git | xargs rm -rf", it'll delete the entire project folder – WhiteWabbit Aug 04 '22 at 13:17