Git配置.gitignore文件忽略被指定的文件上传

 更新时间:2022年04月28日 08:21:55   作者:農碼一生  
这篇文章介绍了Git配置.gitignore文件忽略被指定文件上传的方法,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

在项目的根目录下建立一个.gitignore的文件(和.git文件同级)

.gitignore文件用记事本打开,输入如下内容:

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

上传项目到代码库时,会根据文件中的配置,索引排除对应文件

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

相关文章

  • Git远程仓库配置SSH的实现(以github为例)

    Git远程仓库配置SSH的实现(以github为例)

    本文主要介绍了Git远程仓库配置SSH的实现(以github为例),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2022-07-07
  • VSCode 安装 Copilot 详细过程和实例代码(最新推荐)

    VSCode 安装 Copilot 详细过程和实例代码(最新推荐)

    Copilot 作为一款 AI 辅助编程工具,可以极大地提高开发效率,让编程变得更加轻松愉快,在实际开发过程中,我们要注意审查和测试生成的代码,确保其符合项目需求和标准,这篇文章主要介绍了VSCode 安装 Copilot 详细过程和实例,需要的朋友可以参考下
    2024-05-05
  • 详解git使用小结(本地分支与远程分支、git命令)

    详解git使用小结(本地分支与远程分支、git命令)

    这篇文章主要介绍了git使用小结(本地分支与远程分支、git命令),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-08-08
  • 阿里开源低代码引擎和生态建设实战及思考

    阿里开源低代码引擎和生态建设实战及思考

    这篇文章主要为大家介绍了阿里开源低代码引擎和生态建设实战及思考,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2022-06-06
  • WebStorm 遇到的问题总结

    WebStorm 遇到的问题总结

    这篇文章主要介绍了WebStorm 遇到的问题总结的相关资料,需要的朋友可以参考下
    2017-03-03
  • Eclipse 格式化代码时不换行与自动换行的实现方法

    Eclipse 格式化代码时不换行与自动换行的实现方法

    每次用Eclipse自带的Ctrl+shift+f格式化代码时,如果原来的一行代码大于80列,Eclipse就会自动换为多行,这点个人感觉不是很舒服,简单试了一下,通过以下方式可以修改
    2009-05-05
  • 漂流瓶推送需求的逻辑实现代码

    漂流瓶推送需求的逻辑实现代码

    假想有一个瓶子池,当点击附近标签的时候要从池里面推送一个瓶子给用户.推送按照一定的逻辑对池里的瓶子排序,排序规则主要由两个数据决定:瓶子上次推送时间和与用户之间的距离.
    2010-12-12
  • Jenkins配置maven项目之打包、部署、发布的全过程

    Jenkins配置maven项目之打包、部署、发布的全过程

    这篇文章主要介绍了Jenkins配置maven项目,打包、部署、发布,需要的朋友可以参考下
    2022-02-02
  • VSCode设置网页代码实时预览的实现

    VSCode设置网页代码实时预览的实现

    这篇文章主要介绍了VSCode设置网页代码实时预览的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-04-04
  • XML CDATA的作用

    XML CDATA的作用

    当你用FLASH和xml结合做网站应用程序时,例如你做在我研究游戏排行榜中,当让人自由输入姓名时,人们可以输入一些符号,例如∶"<"、">"、"/"、"?"等,当生成XML时,会破坏了XML结构,使数据中断。
    2009-09-09

最新评论