gitignores.md 2.8 KB
Newer Older
Evan Read's avatar
Evan Read committed
1
# `.gitignore` API
2

Evan Read's avatar
Evan Read committed
3
## List `.gitignore` templates
4

Evan Read's avatar
Evan Read committed
5
Get all `.gitignore` templates.
6 7 8 9 10 11

```
GET /templates/gitignores
```

```bash
12
curl https://gitlab.example.com/api/v4/templates/gitignores
13 14 15 16 17 18 19
```

Example response:

```json
[
  {
20 21
    "key": "Actionscript",
    "name": "Actionscript"
22 23
  },
  {
24
    "key": "Ada",
25 26 27
    "name": "Ada"
  },
  {
28 29
    "key": "Agda",
    "name": "Agda"
30 31
  },
  {
32
    "key": "Android",
33 34 35
    "name": "Android"
  },
  {
36 37
    "key": "AppEngine",
    "name": "AppEngine"
38 39
  },
  {
40 41
    "key": "AppceleratorTitanium",
    "name": "AppceleratorTitanium"
42 43
  },
  {
44
    "key": "ArchLinuxPackages",
45 46 47
    "name": "ArchLinuxPackages"
  },
  {
48
    "key": "Autotools",
49 50 51
    "name": "Autotools"
  },
  {
52 53
    "key": "C",
    "name": "C"
54 55
  },
  {
56 57
    "key": "C++",
    "name": "C++"
58 59
  },
  {
60
    "key": "CFWheels",
61 62 63
    "name": "CFWheels"
  },
  {
64
    "key": "CMake",
65 66 67
    "name": "CMake"
  },
  {
68 69
    "key": "CUDA",
    "name": "CUDA"
70 71
  },
  {
72 73
    "key": "CakePHP",
    "name": "CakePHP"
74 75
  },
  {
76 77
    "key": "ChefCookbook",
    "name": "ChefCookbook"
78 79
  },
  {
80
    "key": "Clojure",
81 82 83
    "name": "Clojure"
  },
  {
84 85
    "key": "CodeIgniter",
    "name": "CodeIgniter"
86 87
  },
  {
88 89
    "key": "CommonLisp",
    "name": "CommonLisp"
90 91
  },
  {
92 93
    "key": "Composer",
    "name": "Composer"
94 95
  },
  {
96 97
    "key": "Concrete5",
    "name": "Concrete5"
98 99 100 101
  }
]
```

Evan Read's avatar
Evan Read committed
102
## Single `.gitignore` template
103

Evan Read's avatar
Evan Read committed
104
Get a single `.gitignore` template.
105 106 107 108 109 110 111

```
GET /templates/gitignores/:key
```

| Attribute  | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
Evan Read's avatar
Evan Read committed
112
| `key`      | string | yes      | The key of the `.gitignore` template |
113 114

```bash
115
curl https://gitlab.example.com/api/v4/templates/gitignores/Ruby
116 117 118 119 120 121 122 123 124 125
```

Example response:

```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"
}
```