working_with_projects.md 19.7 KB
Newer Older
1
---
2 3
stage: Manage
group: Workspace
4 5 6
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
---

7
# Manage projects **(FREE)**
8 9 10 11

Most work in GitLab is done in a [project](../../user/project/index.md). Files and
code are saved in projects, and most features are in the scope of projects.

12
## View projects
13

14
To explore projects:
15

16
1. On the top bar, select **Menu > Projects**.
17
1. Select **Explore projects**.
18

19
The **Projects** page shows a list of projects, sorted by last updated date.
20

21
- To view projects with the most [stars](#star-a-project), select **Most stars**.
22
- To view projects with the largest number of comments in the past month, select **Trending**.
23

24
NOTE:
25
The **Explore projects** tab is visible to unauthenticated users unless the
26
[**Public** visibility level](../admin_area/settings/visibility_and_access_controls.md#restrict-visibility-levels)
27
is restricted. Then the tab is visible only to signed-in users.
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
### Who can view the **Projects** page

When you select a project, the project landing page shows the project contents.

For public projects, and members of internal and private projects
with [permissions to view the project's code](../permissions.md#project-members-permissions),
the project landing page shows:

- A [`README` or index file](repository/index.md#readme-and-index-files).
- A list of directories in the project's repository.

For users without permission to view the project's code, the landing page shows:

- The wiki homepage.
- The list of issues in the project.

### Access a project page with the project ID

> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53671) in GitLab 11.8.

To access a project from the GitLab UI using the project ID,
visit the `/projects/:id` URL in your browser or other tool accessing the project.

52 53
## Explore topics

54
To explore project topics:
55 56 57 58

1. On the top bar, select **Menu > Projects**.
1. Select **Explore topics**.

59
The **Projects** page shows list of topics sorted by the number of associated projects.
60 61 62 63 64 65 66
To view projects associated with a topic, select a topic from the list.

You can assign topics to a project on the [Project Settings page](settings/index.md#topics).

If you're an instance administrator, you can administer all project topics from the
[Admin Area's Topics page](../admin_area/index.md#administering-topics).

67 68 69 70
## Create a project

To create a project in GitLab:

71
1. On the top bar, select **Menu > Project > Create new project**.
72
1. On the **Create new project** page, choose if you want to:
73 74
   - Create a [blank project](#create-a-blank-project).
   - Create a project from a:
75
      - [built-in template](#create-a-project-from-a-built-in-template).
76 77
      - [custom template](#create-a-project-from-a-custom-template).  
      - [HIPAA audit protocol template](#create-a-project-from-the-hipaa-audit-protocol-template).
78
   - [Import a project](../../user/project/import/index.md)
79
     from a different repository. Contact your GitLab administrator if this option is not available.
80
   - [Connect an external repository to GitLab CI/CD](../../ci/ci_cd_for_external_repos/index.md).
81

82
- For a list of words that you cannot use as project names, see 
83
  [reserved project and group names](../../user/reserved_names.md).
84
- For a list of characters that you cannot use in project and group names, see 
85
  [limitations on project and group names](../../user/reserved_names.md#limitations-on-project-and-group-names).
86 87 88 89 90

## Create a blank project

To create a blank project:

91
1. On the top bar, select **Menu > Projects > Create new project**.
92 93
1. Select **Create blank project**.
1. Enter the project details:
94 95
   - In the **Project name** field, enter the name of your project. You cannot use special characters at
     the start or end of a project name.
96 97 98
   - In the **Project slug** field, enter the path to your project. The GitLab instance uses the
     slug as the URL path to the project. To change the slug, first enter the project name,
     then change the slug.
99
   - In the **Project description (optional)** field, enter the description of your project's dashboard.
100 101
   - In the **Project target (optional)** field, select your project's deployment target.
     This information helps GitLab better understand its users and their deployment requirements.
102
   - To modify the project's [viewing and access rights](../public_access.md) for
103
     users, change the **Visibility Level**.
104 105
   - To create README file so that the Git repository is initialized, has a default branch, and
     can be cloned, select **Initialize repository with a README**.
106
   - To analyze the source code in the project for known security vulnerabilities,
107
     select **Enable Static Application Security Testing (SAST)**.
108 109 110 111 112 113 114 115 116 117 118 119 120 121
1. Select **Create project**.

## Create a project from a built-in template

A built-in project template populates a new project with files to get you started.
Built-in templates are sourced from the following groups:

- [`project-templates`](https://gitlab.com/gitlab-org/project-templates)
- [`pages`](https://gitlab.com/pages)

Anyone can contribute a built-in template by following [these steps](https://about.gitlab.com/community/contribute/project-templates/).

To create a project from a built-in template:

122
1. On the top bar, select **Menu > Projects > Create new project**.
123
1. Select **Create from template**.
124
1. Select the **Built-in** tab.
125 126 127 128
1. From the list of templates:
   - To view a preview of the template, select **Preview**.
   - To use a template for the project, select **Use template**.
1. Enter the project details:
129 130
   - In the **Project name** field, enter the name of your project. You cannot use special characters at
     the start or end of a project name.
131 132 133
   - In the **Project slug** field, enter the path to your project. The GitLab instance uses the
     slug as the URL path to the project. To change the slug, first enter the project name,
     then change the slug.
134
   - In the **Project description (optional)** field, enter the description of your project's dashboard.
135
   - To modify the project's [viewing and access rights](../public_access.md) for users,
136
     change the **Visibility Level**.
137
1. Select **Create project**.
138 139

## Create a project from a custom template **(PREMIUM)**
140

141
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/6860) in GitLab 11.2.
142

143 144 145 146 147
Custom project templates are available at:

- The [instance-level](../../user/admin_area/custom_project_templates.md)
- The [group-level](../../user/group/custom_project_templates.md)

148
1. On the top bar, select **Menu > Projects > Create new project**.
149 150 151 152 153 154
1. Select **Create from template**.
1. Select the **Instance** or **Group** tab.
1. From the list of templates:
   - To view a preview of the template, select **Preview**.
   - To use a template for the project, select **Use template**.
1. Enter the project details:
155 156
   - In the **Project name** field, enter the name of your project. You cannot use special characters at
     the start or end of a project name.
157 158 159
   - In the **Project slug** field, enter the path to your project. The GitLab instance uses the
     slug as the URL path to the project. To change the slug, first enter the project name,
     then change the slug.
160
   - The description of your project's dashboard in the **Project description (optional)** field.
161
   - To modify the project's [viewing and access rights](../public_access.md) for users,
162
     change the **Visibility Level**.
163 164 165 166 167 168
1. Select **Create project**.

## Create a project from the HIPAA Audit Protocol template **(ULTIMATE)**

> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13756) in GitLab 12.10

169
The HIPAA Audit Protocol template contains issues for audit inquiries in the
170 171 172 173
HIPAA Audit Protocol published by the U.S Department of Health and Human Services.

To create a project from the HIPAA Audit Protocol template:

174
1. On the top bar, select **Menu > Projects > Create new project**.
175
1. Select **Create from template**.
176
1. Select the **Built-in** tab.
177 178 179 180
1. Locate the **HIPAA Audit Protocol** template:
   - To view a preview of the template, select **Preview**.
   - To use the template for the project, select **Use template**.
1. Enter the project details:
181 182
   - In the **Project name** field, enter the name of your project. You cannot use special characters at
     the start or end of a project name.
183 184 185
   - In the **Project slug** field, enter the path to your project. The GitLab instance uses the
     slug as the URL path to the project. To change the slug, first enter the project name,
     then change the slug.
186
   - In the **Project description (optional)** field, enter the description of your project's dashboard.
187
   - To modify the project's [viewing and access rights](../public_access.md) for users,
188
     change the **Visibility Level**.
189
1. Select **Create project**.
190

191
## Create a new project with Git push
192

193
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/26388) in GitLab 10.5.
194

195
Use `git push` to push a local project repository to GitLab. After you push a repository,
196
GitLab creates your project in your chosen namespace.
197

198
You cannot use `git push` to create projects with project paths that:
199

200
- Have previously been used.
201
- Have been [renamed](settings/index.md#renaming-a-repository).
202

203 204
Previously used project paths have a redirect. The redirect causes push attempts to redirect requests
to the renamed project location, instead of creating a new project. To create a new project for a previously
205
used or renamed project, use the [UI](#create-a-project) or the [Projects API](../../api/projects.md#create-project).
206

207
Prerequisites:
208

209
- To push with SSH, you must have [an SSH key](../../ssh/index.md) that is
210
  [added to your GitLab account](../../ssh/index.md#add-an-ssh-key-to-your-gitlab-account).
211
- You must have permission to add new projects to a namespace. To check if you have permission:
212

213
  1. On the top bar, select **Menu > Projects**.
214 215
  1. Select **Groups**.
  1. Select a group.
216 217
  1. Confirm that **New project** is visible in the upper right
     corner. Contact your GitLab
218
     administrator if you require permission.
219

220
To push your repository and create a project:
221

222
1. Push with SSH or HTTPS:
223
   - To push with SSH:
224

225 226 227
      ```shell
      git push --set-upstream git@gitlab.example.com:namespace/myproject.git master
      ```
228

229
   - To push with HTTPS:
230

231 232 233
      ```shell
      git push --set-upstream https://gitlab.example.com/namespace/myproject.git master
      ```
234

235 236 237 238 239
   - For `gitlab.example.com`, use the domain name of the machine that hosts your Git repository.
   - For `namespace`, use the name of your [namespace](../group/index.md#namespaces).
   - For `myproject`, use the name of your project.
   - Optional. To export existing repository tags, append the `--tags` flag to your `git push` command.
1. Optional. To configure the remote:
240

241 242 243
   ```shell
   git remote add origin https://gitlab.example.com/namespace/myproject.git
   ```
244

245
When the push completes, GitLab displays the message:
246

247 248 249
```shell
remote: The private project namespace/myproject was created.
```
250

251
To view your new project, go to `https://gitlab.example.com/namespace/myproject`.
252
Your project's visibility is set to **Private** by default. To change project visibility, adjust your
253
[project's settings](../public_access.md#change-project-visibility).
254 255 256

## Star a project

257
You can add a star to projects you use frequently to make them easier to find.
258

259
To add a star to a project:
260

261
1. On the top bar, select **Menu > Projects**.
262 263 264
1. Select **Your projects** or **Explore projects**.
1. Select a project.
1. In the upper right corner of the page, select **Star**.
265

266
## View starred projects
267

268
1. On the top bar, select **Menu > Projects**.
269
1. Select **Starred projects**.
270 271
1. GitLab displays information about your starred projects, including:

272 273 274 275 276
   - Project description, including name, description, and icon.
   - Number of times this project has been starred.
   - Number of times this project has been forked.
   - Number of open merge requests.
   - Number of open issues.
277 278 279

## Delete a project

280 281
After you delete a project, projects in personal namespaces are deleted immediately. To delay deletion of projects in a group
you can [enable delayed project removal](../group/index.md#enable-delayed-project-deletion).
282 283

To delete a project:
284

285
1. On the top bar, select **Menu > Projects**.
286 287 288
1. Select **Your projects** or **Explore projects**.
1. Select a project.
1. Select **Settings > General**.
289 290
1. Expand the **Advanced** section.
1. Scroll down to the **Delete project** section.
291
1. Select **Delete project**.
292
1. Confirm this action by completing the field.
293

294
## View projects pending deletion **(PREMIUM)**
295

296
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37014) in GitLab 13.3 for Administrators.
297
> - [Tab renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/347468) from **Deleted projects** in GitLab 14.6.
298
> - [Available to all users](https://gitlab.com/gitlab-org/gitlab/-/issues/346976) in GitLab 14.8 [with a flag](../../administration/feature_flags.md) named `project_owners_list_project_pending_deletion`. Enabled by default.
299
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/351556) in GitLab 14.9. [Feature flag `project_owners_list_project_pending_deletion`](https://gitlab.com/gitlab-org/gitlab/-/issues/351556) removed.
300 301

When delayed project deletion is [enabled for a group](../group/index.md#enable-delayed-project-deletion),
302 303 304
projects within that group are not deleted immediately, but only after a delay. 

To view a list of all projects that are pending deletion:
305 306

1. On the top bar, select **Menu > Projects > Explore projects**.
307 308 309
1. Based on your GitLab version:
   - GitLab 14.6 and later: select the **Pending deletion** tab.
   - GitLab 14.5 and earlier: select the **Deleted projects** tab.
310

311
Each project in the list shows:
312 313 314 315 316

- The time the project was marked for deletion.
- The time the project is scheduled for final deletion.
- A **Restore** link to stop the project being eventually deleted.

317
## View project activity
318

319
To view the activity of a project:
320

321
1. On the top bar, select **Menu > Projects**.
322 323 324 325
1. Select **Your projects** or **Explore projects**.
1. Select a project.
1. On the left sidebar, select **Project information > Activity**.
1. Select a tab to view the type of project activity.
326

327
## Leave a project
328

329
If you leave a project, you are no longer a project
330
member and cannot contribute.
331

332
To leave a project:
333

334
1. On the top bar, select **Menu > Projects**.
335 336
1. Select **Your projects** or **Explore projects**.
1. Select a project.
337 338
1. Select **Leave project**. The **Leave project** option only displays
on the project dashboard when a project is part of a group under a
339
[group namespace](../group/index.md#namespaces).
340

341
## Use a project as a Go package
342

343 344 345
Prerequisites:

- Contact your administrator to enable the [GitLab Go Proxy](../packages/go_proxy/index.md).
346
- To use a private project in a subgroup as a Go package, you must [authenticate Go requests](#authenticate-go-requests-to-private-projects). Go requests that are not authenticated cause
347 348 349 350
`go get` to fail. You don't need to authenticate Go requests for projects that are not in subgroups.

To use a project as a Go package, use the `go get` and `godoc.org` discovery requests. You can use the meta tags:

351
- [`go-import`](https://pkg.go.dev/cmd/go#hdr-Remote_import_paths)
352 353 354 355 356 357 358 359 360 361
- [`go-source`](https://github.com/golang/gddo/wiki/Source-Code-Links)

### Authenticate Go requests to private projects

Prerequisites:

- Your GitLab instance must be accessible with HTTPS.
- You must have a [personal access token](../profile/personal_access_tokens.md).

To authenticate Go requests, create a [`.netrc`](https://everything.curl.dev/usingcurl/netrc) file with the following information:
362 363 364 365 366 367 368 369 370

```plaintext
machine gitlab.example.com
login <gitlab_user_name>
password <personal_access_token>
```

On Windows, Go reads `~/_netrc` instead of `~/.netrc`.

371 372 373
The `go` command does not transmit credentials over insecure connections. It authenticates
HTTPS requests made by Go, but does not authenticate requests made
through Git.
374

375
### Authenticate Git requests
376

377 378
If Go cannot fetch a module from a proxy, it uses Git. Git uses a `.netrc` file to authenticate requests, but you can
configure other authentication methods.
379

380
Configure Git to either:
381

382
- Embed credentials in the request URL:
383

384 385 386
    ```shell
    git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"
    ```
387

388
- Use SSH instead of HTTPS:
389

390 391 392
    ```shell
    git config --global url."git@gitlab.example.com".insteadOf "https://gitlab.example.com"
    ```
393

394
### Disable Go module fetching for private projects
395

396 397
To [fetch modules or packages](../../development/go_guide/dependencies.md#fetching), Go uses
the [environment variables](../../development/go_guide/dependencies.md#proxies):
398

399 400 401 402 403 404 405 406 407 408 409 410 411
- `GOPRIVATE`
- `GONOPROXY`
- `GONOSUMDB`

To disable fetching:

1. Disable `GOPRIVATE`:
    - To disable queries for one project, disable `GOPRIVATE=gitlab.example.com/my/private/project`.
    - To disable queries for all projects on GitLab.com, disable `GOPRIVATE=gitlab.example.com`.
1. Disable proxy queries in `GONOPROXY`.
1. Disable checksum queries in `GONOSUMDB`.

- If the module name or its prefix is in `GOPRIVATE` or `GONOPROXY`, Go does not query module
412
  proxies.
413
- If the module name or its prefix is in `GONOPRIVATE` or `GONOSUMDB`, Go does not query
414
  Checksum databases.
415 416 417 418 419 420 421 422 423 424 425

### Fetch Go modules from Geo secondary sites

Use [Geo](../../administration/geo/index.md) to access Git repositories that contain Go modules
on secondary Geo servers.

You can use SSH or HTTP to access the Geo secondary server.

#### Use SSH to access the Geo secondary server

To access the Geo secondary server with SSH:
426 427 428

1. Reconfigure Git on the client to send traffic for the primary to the secondary:

429
   ```shell
430 431 432 433
   git config --global url."git@gitlab-secondary.example.com".insteadOf "https://gitlab.example.com"
   git config --global url."git@gitlab-secondary.example.com".insteadOf "http://gitlab.example.com"
   ```

434 435 436 437 438 439 440 441
    - For `gitlab.example.com`, use the primary site domain name.
    - For `gitlab-secondary.example.com`, use the secondary site domain name.

1. Ensure the client is set up for SSH access to GitLab repositories. You can test this on the primary,
   and GitLab replicates the public key to the secondary.

The `go get` request generates HTTP traffic to the primary Geo server. When the module
download starts, the `insteadOf` configuration sends the traffic to the secondary Geo server.
442 443 444

#### Use HTTP to access the Geo secondary

445 446
You must use persistent access tokens that replicate to the secondary server. You cannot use
CI/CD job tokens to fetch Go modules with HTTP.
447

448
To access the Geo secondary server with HTTP:
449

450
1. Add a Git `insteadOf` redirect on the client:
451

452
   ```shell
453 454 455
   git config --global url."https://gitlab-secondary.example.com".insteadOf "https://gitlab.example.com"
   ```

456 457 458
   - For `gitlab.example.com`, use the primary site domain name.
   - For `gitlab-secondary.example.com`, use the secondary site domain name.

459
1. Generate a [personal access token](../profile/personal_access_tokens.md) and
460
   add the credentials in the client's `~/.netrc` file:
461

462
   ```shell
463 464 465 466
   machine gitlab.example.com login USERNAME password TOKEN
   machine gitlab-secondary.example.com login USERNAME password TOKEN
   ```

467 468
The `go get` request generates HTTP traffic to the primary Geo server. When the module
download starts, the `insteadOf` configuration sends the traffic to the secondary Geo server.
469 470 471 472 473 474 475

## Related topics

- [Import a project](../../user/project/import/index.md).
- [Connect an external repository to GitLab CI/CD](../../ci/ci_cd_for_external_repos/index.md).
- [Fork a project](repository/forking_workflow.md#creating-a-fork).
- [Adjust project visibility and access levels](settings/index.md#sharing-and-permissions).
476
- [Limitations on project and group names](../../user/reserved_names.md#limitations-on-project-and-group-names)