.gitignore API

  • Tier: 基础版, 专业版, 旗舰版
  • Offering: JihuLab.com, 私有化部署

在极狐GitLab 中,/gitignores 端点返回 Git .gitignore 模板的列表。欲了解更多信息,请参阅 Git 文档中的 .gitignore

具有访客角色的用户无法访问 .gitignore 模板。欲了解更多信息,请参阅项目和群组可见性

获取所有 .gitignore 模板#

获取所有 .gitignore 模板的列表:

plaintext
GET /templates/gitignores

示例请求:

shell
curl "https://gitlab.example.com/api/v4/templates/gitignores"

示例响应:

json
1[ 2 { 3 "key": "Actionscript", 4 "name": "Actionscript" 5 }, 6 { 7 "key": "Ada", 8 "name": "Ada" 9 }, 10 { 11 "key": "Agda", 12 "name": "Agda" 13 }, 14 { 15 "key": "Android", 16 "name": "Android" 17 }, 18 { 19 "key": "AppEngine", 20 "name": "AppEngine" 21 }, 22 { 23 "key": "AppceleratorTitanium", 24 "name": "AppceleratorTitanium" 25 }, 26 { 27 "key": "ArchLinuxPackages", 28 "name": "ArchLinuxPackages" 29 }, 30 { 31 "key": "Autotools", 32 "name": "Autotools" 33 }, 34 { 35 "key": "C", 36 "name": "C" 37 }, 38 { 39 "key": "C++", 40 "name": "C++" 41 }, 42 { 43 "key": "CFWheels", 44 "name": "CFWheels" 45 }, 46 { 47 "key": "CMake", 48 "name": "CMake" 49 }, 50 { 51 "key": "CUDA", 52 "name": "CUDA" 53 }, 54 { 55 "key": "CakePHP", 56 "name": "CakePHP" 57 }, 58 { 59 "key": "ChefCookbook", 60 "name": "ChefCookbook" 61 }, 62 { 63 "key": "Clojure", 64 "name": "Clojure" 65 }, 66 { 67 "key": "CodeIgniter", 68 "name": "CodeIgniter" 69 }, 70 { 71 "key": "CommonLisp", 72 "name": "CommonLisp" 73 }, 74 { 75 "key": "Composer", 76 "name": "Composer" 77 }, 78 { 79 "key": "Concrete5", 80 "name": "Concrete5" 81 } 82]

获取单个 .gitignore 模板#

获取单个 .gitignore 模板:

plaintext
GET /templates/gitignores/:key
属性类型必须描述
keystring.gitignore 模板的键

示例请求:

shell
curl "https://gitlab.example.com/api/v4/templates/gitignores/Ruby"

示例响应:

json
{ "name": "Ruby", "content": "*.gem\n*.rbc\n/.config\n/coverage/\n/InstalledFiles\n/pkg/\n/spec/reports/\n/spec/examples.txt\n/test/tmp/\n/test/version_tmp/\n/tmp/\n\n# Used by dotenv library to load environment variables.\n# .env\n\n## Specific to RubyMotion:\n.dat*\n.repl_history\nbuild/\n*.bridgesupport\nbuild-iPhoneOS/\nbuild-iPhoneSimulator/\n\n## Specific to RubyMotion (use of CocoaPods):\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control\n#\n# vendor/Pods/\n\n## Documentation cache and generated files:\n/.yardoc/\n/_yardoc/\n/doc/\n/rdoc/\n\n## Environment normalization:\n/.bundle/\n/vendor/bundle\n/lib/bundler/man/\n\n# for a library or gem, you might want to ignore these files since the code is\n# intended to run in multiple environments; otherwise, check them in:\n# Gemfile.lock\n# .ruby-version\n# .ruby-gemset\n\n# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:\n.rvmrc\n" }