debian-mirror-gitlab/doc/user/project/working_with_projects.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

428 lines
16 KiB
Markdown
Raw Normal View History

2021-03-11 19:13:27 +05:30
---
2023-05-27 22:25:52 +05:30
stage: Data Stores
group: Tenant Scale
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2021-03-11 19:13:27 +05:30
---
2022-01-26 12:08:38 +05:30
# Manage projects **(FREE)**
2021-03-11 19:13:27 +05:30
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.
2022-01-26 12:08:38 +05:30
## View projects
2021-03-11 19:13:27 +05:30
2023-05-27 22:25:52 +05:30
To view all your projects, on the top bar, select **Main menu > Projects > View all projects**.
2021-03-11 19:13:27 +05:30
2023-05-27 22:25:52 +05:30
To browse all public projects, select **Main menu > Explore > Projects**.
2022-11-25 23:54:43 +05:30
2022-10-11 01:57:18 +05:30
### Who can view the Projects page
2022-01-26 12:08:38 +05:30
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.
2021-09-30 23:02:18 +05:30
2021-12-11 22:18:48 +05:30
## Explore topics
2022-01-26 12:08:38 +05:30
To explore project topics:
2021-12-11 22:18:48 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects > View all projects**.
1. Select the **Explore topics** tab.
1. To view projects associated with a topic, select a topic.
The **Explore topics** tab shows a list of topics sorted by the number of associated projects.
2021-12-11 22:18:48 +05:30
2022-07-23 23:45:48 +05:30
You can assign topics to a project on the [Project Settings page](settings/index.md#assign-topics-to-a-project).
2021-12-11 22:18:48 +05:30
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).
2021-03-11 19:13:27 +05:30
## Star a project
2022-01-26 12:08:38 +05:30
You can add a star to projects you use frequently to make them easier to find.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
To add a star to a project:
2021-03-11 19:13:27 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2023-05-27 22:25:52 +05:30
1. In the upper-right corner of the page, select **Star**.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
## View starred projects
2021-03-11 19:13:27 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects > View all projects**.
1. Select the **Starred projects** tab.
2021-03-11 19:13:27 +05:30
1. GitLab displays information about your starred projects, including:
2022-01-26 12:08:38 +05:30
- 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.
2021-03-11 19:13:27 +05:30
2022-07-16 23:28:13 +05:30
## View personal projects
Personal projects are projects created under your personal namespace.
For example, if you create an account with the username `alex`, and create a project
called `my-project` under your username, the project is created at `https://gitlab.example.com/alex/my-project`.
To view your personal projects:
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects > View all projects**.
2023-04-23 21:23:45 +05:30
1. In the **Yours** tab, select **Personal**.
2022-07-16 23:28:13 +05:30
2021-03-11 19:13:27 +05:30
## Delete a project
2022-01-26 12:08:38 +05:30
After you delete a project, projects in personal namespaces are deleted immediately. To delay deletion of projects in a group
2022-08-27 11:52:29 +05:30
you can [enable delayed project removal](../group/manage.md#enable-delayed-project-deletion).
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
To delete a project:
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-01-26 12:08:38 +05:30
1. Select **Settings > General**.
2021-03-11 19:13:27 +05:30
1. Expand the **Advanced** section.
1. Scroll down to the **Delete project** section.
2022-05-07 20:08:51 +05:30
1. Select **Delete project**.
2022-01-26 12:08:38 +05:30
1. Confirm this action by completing the field.
2021-03-11 19:13:27 +05:30
2022-05-07 20:08:51 +05:30
## View projects pending deletion **(PREMIUM)**
2022-04-04 11:22:00 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37014) in GitLab 13.3 for Administrators.
> - [Tab renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/347468) from **Deleted projects** in GitLab 14.6.
> - [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.
2022-05-07 20:08:51 +05:30
> - [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.
2022-04-04 11:22:00 +05:30
2022-08-27 11:52:29 +05:30
When delayed project deletion is [enabled for a group](../group/manage.md#enable-delayed-project-deletion),
2022-06-21 17:19:12 +05:30
projects within that group are not deleted immediately, but only after a delay.
2022-05-07 20:08:51 +05:30
To view a list of all projects that are pending deletion:
2022-04-04 11:22:00 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects > View all projects**.
2022-05-07 20:08:51 +05:30
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.
2022-04-04 11:22:00 +05:30
2022-05-07 20:08:51 +05:30
Each project in the list shows:
2022-04-04 11:22:00 +05:30
- 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.
2022-01-26 12:08:38 +05:30
## View project activity
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
To view the activity of a project:
2021-03-11 19:13:27 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project..
2022-01-26 12:08:38 +05:30
1. On the left sidebar, select **Project information > Activity**.
1. Select a tab to view the type of project activity.
2021-03-11 19:13:27 +05:30
2022-07-23 23:45:48 +05:30
## Search in projects
You can search through your projects.
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu**.
2022-07-23 23:45:48 +05:30
1. In **Search your projects**, type the project name.
GitLab filters as you type.
You can also look for the projects you [starred](#star-a-project) (**Starred projects**).
You can **Explore** all public and internal projects available in GitLab.com, from which you can filter by visibility,
through **Trending**, best rated with **Most stars**, or **All** of them.
You can sort projects by:
- Name
- Created date
- Updated date
- Owner
You can also choose to hide or show archived projects.
2023-04-23 21:23:45 +05:30
### Filter projects by language
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/385465) in GitLab 15.9 [with a flag](../../administration/feature_flags.md) named `project_language_search`. Enabled by default.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110956) in GitLab 15.9. Feature flag `project_language_search` removed.
You can filter projects by the programming language they use. To do this:
1. On the top bar, select **Main menu > Projects > View all projects**.
1. From the **Language** dropdown list, select the language you want to filter projects by.
A list of projects that use the selected language is displayed.
2023-03-04 22:38:38 +05:30
## Change the visibility of individual features in a project
You can change the visibility of individual features in a project.
Prerequisite:
- You must have the Owner role for the project.
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Settings > General**.
1. Expand **Visibility, project features, permissions**.
1. Use the toggle by each feature you want to turn on or off, or change access for.
1. Select **Save changes**.
2022-01-26 12:08:38 +05:30
## Leave a project
2021-03-11 19:13:27 +05:30
2023-03-04 22:38:38 +05:30
When you leave a project:
- You are no longer a project member and cannot contribute.
- All the issues and merge requests that were assigned
to you are unassigned.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
To leave a project:
2021-09-04 01:27:46 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-01-26 12:08:38 +05:30
1. Select **Leave project**. The **Leave project** option only displays
on the project dashboard when a project is part of a group under a
2022-08-27 11:52:29 +05:30
[group namespace](../namespace/index.md).
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
## Use a project as a Go package
Prerequisites:
- Contact your administrator to enable the [GitLab Go Proxy](../packages/go_proxy/index.md).
2022-03-02 08:16:31 +05:30
- 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
2022-01-26 12:08:38 +05:30
`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:
- [`go-import`](https://pkg.go.dev/cmd/go#hdr-Remote_import_paths)
- [`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.
2022-08-13 15:12:31 +05:30
- You must have a [personal access token](../profile/personal_access_tokens.md) with `read_api` scope.
2022-01-26 12:08:38 +05:30
To authenticate Go requests, create a [`.netrc`](https://everything.curl.dev/usingcurl/netrc) file with the following information:
2021-03-11 19:13:27 +05:30
```plaintext
machine gitlab.example.com
login <gitlab_user_name>
password <personal_access_token>
```
On Windows, Go reads `~/_netrc` instead of `~/.netrc`.
2022-01-26 12:08:38 +05:30
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.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
### Authenticate Git requests
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
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.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
Configure Git to either:
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
- Embed credentials in the request URL:
2021-03-11 19:13:27 +05:30
2023-05-27 22:25:52 +05:30
```shell
git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"
```
2022-01-26 12:08:38 +05:30
- Use SSH instead of HTTPS:
2023-05-27 22:25:52 +05:30
```shell
git config --global url."git@gitlab.example.com:".insteadOf "https://gitlab.example.com/"
```
2022-01-26 12:08:38 +05:30
### Disable Go module fetching for private projects
To [fetch modules or packages](../../development/go_guide/dependencies.md#fetching), Go uses
the [environment variables](../../development/go_guide/dependencies.md#proxies):
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
- `GOPRIVATE`
- `GONOPROXY`
- `GONOSUMDB`
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
To disable fetching:
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
1. Disable `GOPRIVATE`:
2023-05-27 22:25:52 +05:30
- 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`.
2022-01-26 12:08:38 +05:30
1. Disable proxy queries in `GONOPROXY`.
1. Disable checksum queries in `GONOSUMDB`.
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
- If the module name or its prefix is in `GOPRIVATE` or `GONOPROXY`, Go does not query module
2022-06-21 17:19:12 +05:30
proxies.
2022-01-26 12:08:38 +05:30
- If the module name or its prefix is in `GONOPRIVATE` or `GONOSUMDB`, Go does not query
2022-06-21 17:19:12 +05:30
Checksum databases.
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
### 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:
2021-11-11 11:23:49 +05:30
1. Reconfigure Git on the client to send traffic for the primary to the secondary:
2022-01-26 12:08:38 +05:30
```shell
2021-11-11 11:23:49 +05:30
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"
```
2023-05-27 22:25:52 +05:30
- For `gitlab.example.com`, use the primary site domain name.
- For `gitlab-secondary.example.com`, use the secondary site domain name.
2022-01-26 12:08:38 +05:30
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.
2021-11-11 11:23:49 +05:30
#### Use HTTP to access the Geo secondary
2022-01-26 12:08:38 +05:30
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.
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
To access the Geo secondary server with HTTP:
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
1. Add a Git `insteadOf` redirect on the client:
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
```shell
2021-11-11 11:23:49 +05:30
git config --global url."https://gitlab-secondary.example.com".insteadOf "https://gitlab.example.com"
```
2022-01-26 12:08:38 +05:30
- For `gitlab.example.com`, use the primary site domain name.
- For `gitlab-secondary.example.com`, use the secondary site domain name.
2021-11-11 11:23:49 +05:30
1. Generate a [personal access token](../profile/personal_access_tokens.md) and
2022-01-26 12:08:38 +05:30
add the credentials in the client's `~/.netrc` file:
2021-11-11 11:23:49 +05:30
2022-01-26 12:08:38 +05:30
```shell
2021-11-11 11:23:49 +05:30
machine gitlab.example.com login USERNAME password TOKEN
machine gitlab-secondary.example.com login USERNAME password TOKEN
```
2022-01-26 12:08:38 +05:30
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.
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
## Related topics
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
- [Import a project](../../user/project/import/index.md).
- [Connect an external repository to GitLab CI/CD](../../ci/ci_cd_for_external_repos/index.md).
2023-06-20 00:43:36 +05:30
- [Fork a project](repository/forking_workflow.md#create-a-fork).
2022-07-23 23:45:48 +05:30
- [Adjust project visibility and access levels](settings/index.md#configure-project-visibility-features-and-permissions).
2022-05-07 20:08:51 +05:30
- [Limitations on project and group names](../../user/reserved_names.md#limitations-on-project-and-group-names)
2022-11-25 23:54:43 +05:30
## Troubleshooting
When working with projects, you might encounter the following issues, or require alternate methods to complete specific tasks.
### Find projects using an SQL query
While in [a Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session), you can find and store an array of projects based on a SQL query:
```ruby
# Finds projects that end with '%ject'
projects = Project.find_by_sql("SELECT * FROM projects WHERE name LIKE '%ject'")
=> [#<Project id:12 root/my-first-project>>, #<Project id:13 root/my-second-project>>]
```
### Clear a project's or repository's cache
If a project or repository has been updated but the state is not reflected in the UI, you may need to clear the project's or repository's cache.
You can do so through [a Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session) and one of the following:
WARNING:
2023-01-13 00:05:48 +05:30
Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore.
2022-11-25 23:54:43 +05:30
```ruby
## Clear project cache
ProjectCacheWorker.perform_async(project.id)
## Clear repository .exists? cache
project.repository.expire_exists_cache
```
### Find projects that are pending deletion
If you need to find all projects marked for deletion but that have not yet been deleted,
[start a Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session) and run the following:
```ruby
projects = Project.where(pending_delete: true)
projects.each do |p|
puts "Project ID: #{p.id}"
puts "Project name: #{p.name}"
puts "Repository path: #{p.repository.full_path}"
end
```
### Delete a project using console
If a project cannot be deleted, you can attempt to delete it through [Rails console](../../administration/operations/rails_console.md#starting-a-rails-console-session).
WARNING:
2023-01-13 00:05:48 +05:30
Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore.
2022-11-25 23:54:43 +05:30
```ruby
project = Project.find_by_full_path('<project_path>')
user = User.find_by_username('<username>')
ProjectDestroyWorker.new.perform(project.id, user.id, {})
```
If this fails, display why it doesn't work with:
```ruby
project = Project.find_by_full_path('<project_path>')
project.delete_error
```
### Toggle a feature for all projects within a group
While toggling a feature in a project can be done through the [projects API](../../api/projects.md),
you may need to do this for a large number of projects.
To toggle a specific feature, you can [start a Rails console session](../../administration/operations/rails_console.md#starting-a-rails-console-session)
and run the following function:
WARNING:
2023-01-13 00:05:48 +05:30
Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore.
2022-11-25 23:54:43 +05:30
```ruby
projects = Group.find_by_name('_group_name').projects
projects.each do |p|
## replace <feature-name> with the appropriate feature name in all instances
state = p.<feature-name>
if state != 0
puts "#{p.name} has <feature-name> already enabled. Skipping..."
else
puts "#{p.name} didn't have <feature-name> enabled. Enabling..."
p.project_feature.update!(<feature-name>: ProjectFeature::PRIVATE)
end
end
```
To find features that can be toggled, run `pp p.project_feature`.
Available permission levels are listed in
[concerns/featurable.rb](https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/featurable.rb).