Creating a .gitignore file - How we can use git ignore to prevent adding unwanted files to git

preview_player
Показать описание
A .gitignore file is a great and simple tool we can use to prevent including unwanted files in a git repository. This file can be used to simply ignore files and directories but also be used to create complex rules and partial rules to ignore select files.

In this video GitGuardian developer advocate, Mackenzie, runs through exactly how to get started with both a local and a global .gitignore file and shows exactly how the file works. This is designed as an introduction so that you have the knowledge to understand more complex uses for the .gitignore files.

What is a .gitignore file 0:00
Creating a .gitignore file 2:09
Ignoring a file in git 3:06
Ignoring a directory 3:49
Ignoring file extensions in git 4:48
Excluding file path 6:09
Adding an exception to .gitingore file 6:49
Ignoring all directories git 7:31
Ignoring partial name 7:40
Creating global .gitignore file 8:28

Who is Mackenzie Jackson?
Mackenzie is a developer advocate with a passion for DevOps and code security. As the co-founder and former CTO of a health tech startup, he learnt first-hand how critical it is to build secure applications with robust developer operations.
Today as the Developer Advocate at GitGuardian, Mackenzie is able to share his passion for code security with developers and works closely with research teams to show how malicious actors discover and exploit vulnerabilities in code.

What is GitGuardian?
GitGuardian is the code security platform for the DevOps generation. With automated secrets detection and remediation, our platform enables Dev, Sec, and Ops to advance together towards the Secure Software Development Lifecycle.
Рекомендации по теме
Комментарии
Автор

best .gitignore video I've seen so far with more advanced examples

finix
Автор

I just recently installed git and trying to learn it but when I do git status why does it show desktop.ini files. Can u please make a video on it to resolve them so that they don't interfere in future too ??? I have heard that it's due to I don't know Google drive errors...

akashkarn
Автор

Is there a simple way to ignore all .config files in parent folder and subfolders besides writing all paths in parent folder gitignore?

FCMN
Автор

For some reason in WIndows 10 vscode, after adding .py file to .gitignore it does not disappear when I run git status. It still appears! I think I have to make a commit first to ignore the file. edit my bad it does work i forgot to add the asterisk. Thanks for the video - liked and subscribed.

ajayjoseph
Автор

Hello bro, I have been investigating to solve my problem but I can't find an answer. I want only and exclusively to have in my github .c, .h, .cpp files, etc. My text editor (SublimeText) configured for competitive programming in CodeForces/SPOJ of C++ generates files without extension, without dots let's say.
They tell me to add this to .gitignore
*
!/**/
!*.*
But it doesn't work. Recommendations?

JuniorMLT
Автор

Excellent tutorial! Congrats! I just have a question. I've added some audio files to my GitHub repository and now I'm trying to ignore them, but it doesn't work. How can I fix this? I've been trying everything but I couldn't resolve it. can you help me?

fredsonsilva
visit shbcf.ru