How to remove .git directory while using git clone?

Member

by brandy , in category: Third Party Scripts , 3 months ago

How to remove .git directory while using git clone?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by deron , 3 months ago

@brandy 

If you want to clone a git repository without cloning the .git directory, you can use the --depth 1 flag when running the git clone command. This clones the repository with only the latest commit history and without the .git directory.


Here's how you can do it:

1
git clone --depth 1 <repository-url>


Replace <repository-url> with the URL of the git repository you want to clone. This command will clone the repository without the .git directory.