본문 바로가기
카테고리 없음

[Git] gitignore 자동으로 구성해주는 사이트

by 40대직장인 2022. 4. 13.

.gitignore를 어떻게 설정해야 하나?

: git에 프로젝트 파일들을 올려주는 과정에서 gitignore 파일을 제대로 설정해주지 않았더니 다른 노트북에서 프로젝트를 실행할 때 프로젝트가 빌드가 되지 않는 문제가 발생하였다.

gitignore 파일의 위치도 이상했을 뿐더러, gitignore에 어떤 것들을 추가해야 하는지 모르는 상태에서 프로젝트 빌드에 필요한 Gradle 스크립트까지 모두 gitignore에 추가해버리니 오류가 나는 건 당연한 수순이었다. 

1. .gitignore 파일의 위치

git을 공부한 사람에게는 당연한 얘기겠지만, .gitignore 파일은 프로젝트가 존재하는 최고 상위 폴더에 위치시켜야 한다!

 

[예시 : 안드로이드 프로젝트의 경우]

MyAndroidApp/   
  ├──app/   
    ├──src/
    ├──build/
    ├──libs/
  ├──gradle/   
  ├── settings.gradle   
  ├── build.gradle   
  ├── .gitignore   

 

2. .gitignore를 자동으로 구성해주는 사이트

www.gitignore.io

위 사이트가 .gitignore에 들어갈 코드들을 자동으로 생성해주는 사이트이다. 검색창에 운영체제, IDE, 프로그래밍 언어, 플랫폼 등을 입력하고 ‘생성’ 버튼을 클릭하면 해당 키워드에 맞는 gitignore 파일을 자동으로 구성해준다.

 

IDE(Integrated Development Environment)는 프로그래밍을 위한 통합 개발 환경으로서 에디터, 컴파일러, 디버그 등 프로그래밍에 필요한 툴이 하나의 인터페이스로 통합되어 사용 가능한 개발 환경을 말한다.

IDE의 추세는 대부분 이클립스(Eclipse) 비주얼 닷넷 스튜디오(Visual.net Studio)가 주도한다. 이클립스는 Java 개발자에게 필수적인 통합 개발 환경이며, 이 통합 개발 환경을 가진 이클립스는 아이디어 공유와 협업, 빠른 작업이 가능한 플랫폼이다.

안드로이드 프로젝트를 진행할 경우 위와 비슷하게 키워드를 작성할 수 있다.
아래는 이렇게 검색하였을 때 나오는 gitignore 코드이다.

# Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,java,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,java,windows

### Android ###
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
#  Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

### Android Patch ###
gen-external-apklibs
output.json

# Replacement of .externalNativeBuild directories introduced
# with Android Studio 3.5.

### Java ###
# Compiled class file

# Log file

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.

# Built application files

# Files for the ART/Dalvik VM

# Java class files

# Generated files

# Gradle files
.gradle

# Signing files
.signing/

# Local configuration file (sdk path, etc)

# Proguard folder generated by Eclipse

# Log Files

# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
*.ipr
*~
*.swp

# Android Patch

# External native build folder generated in Android Studio 2.2 and later

# NDK
obj/

# IntelliJ IDEA
*.iws
/out/

# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes

# Legacy Eclipse project files
.classpath
.project
.cproject
.settings/

# Mobile Tools for Java (J2ME)

# Package Files #

# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)

## Plugin-specific files:

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Mongo Explorer plugin
.idea/mongoSettings.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### AndroidStudio Patch ###

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,java,windows

 

 

댓글