I know how to clone a Git repository, but these files (in .gitignore) How-To clone them?

File(s)/Folder(s) in .gitignore, how to copy/clone in another PC for cloning Web App e.g., Laravel App

I know how to clone a Git repository, but these files (in .gitignore) How-To clone them???

When you clone a git repository, files specified in the .gitignore file are not included in the clone. The .gitignore file is used to tell git which files or directories to ignore when committing changes to the repository.

These ignored files often include local configuration files, logs, or files that are auto-generated by your tools, which aren’t necessary (or are actively harmful) to share with others.

If you want to clone a repository and also get the files that are listed in .gitignore, you will have to copy them over manually (assuming f you have access to the original repository).

2 Likes

Thank you! for your reply…

So, is Not recommended delete .gitignore and clone the whole repo…
And, is recommended COPY files - of .gitignore - may on a USB Stick to transfer to other PC, correct?

Correct, generally it’s not recommended to delete the .gitignore file just to clone the whole repository, including ignored files. The .gitignore file is there for a reason: it prevents certain files that don’t belong in the repository (like compiled binaries, logs, local configurations, or secret keys) from being added to the repository.

If you need to transfer files that are ignored by .gitignore it would be better to manually copy those files to the other PC using a USB stick. You could also use cloud storage, but this should only be done for files that are safe to share. Never let sensitive files (e.g. secret keys) touch the internet.

If you are looking to clone the full working environment including the ignored files, you might want to look into creating a Docker container that can be easily transferred to another machine. This way, you can version control your environment setup and easily share and reproduce it across different machines.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.