Skip to content

Latest commit

 

History

History
511 lines (341 loc) · 19.4 KB

working_with_projects.md

File metadata and controls

511 lines (341 loc) · 19.4 KB
stage group info
Data Stores
Tenant Scale
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

Manage projects (FREE)

Most work in GitLab is done in a project. Files and code are saved in projects, and most features are in the scope of projects.

View all projects for the instance

To view all projects for the GitLab instance:

  1. On the left sidebar, expand the top-most chevron ({chevron-down}).
  2. Select Explore.

On the left sidebar, Projects is selected. On the right, the list shows all projects for the instance.

If you are not authenticated, then the list shows public projects only.

View projects you are a member of

To view projects you are a member of:

  1. On the left sidebar, expand the top-most chevron ({chevron-down}).
  2. Select Your work.

On the left sidebar, Projects is selected. On the list, on the Yours tab, all the projects you are a member of are displayed.

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:

  1. On the left sidebar, select your avatar and then your username.
  2. On the left sidebar, select Personal projects.

View starred projects

To view projects you have starred:

  1. On the left sidebar, select your avatar and then your username.
  2. On the left sidebar, select Starred projects.

Organizing projects with topics

Topics are labels that you can assign to projects to help you organize and find them. A topic is typically a short name that describes the content or purpose of a project. You can assign a topic to several projects.

For example, you can create and assign the topics python and hackathon to all projects that use Python and are intended for Hackathon contributions.

Topics assigned to a project are listed in the Project overview, below the project name and activity information.

Only users with access to the project can see the topics assigned to that project, but everyone (including unauthenticated users) can see the topics available on the GitLab instance. Do not include sensitive information in the name of a topic.

Explore topics

To explore project topics:

  1. On the left sidebar, expand the top-most chevron ({chevron-down}).
  2. Select Explore.
  3. On the left sidebar, select Topics.
  4. To view projects associated with a topic, select a topic.

The Explore topics page shows a list of projects with this topic.

Filter and sort topics

You can filter the list of projects that have a certain topic by:

  • Name
  • Language
  • Owner
  • Archive status
  • Visibility

You can sort the projects by:

  • Date created
  • Date updated
  • Name
  • Number of stars

Subscribe to a topic

If you want to know when new projects are added to a topic, you can use its RSS feed.

You can do this either from the Explore topics page or a project with topics.

To subscribe to a topic:

  • From the Explore topics page:

    1. On the left sidebar, expand the top-most chevron ({chevron-down}).
    2. Select Explore.
    3. Select Topics.
    4. Select the topic you want to subscribe to.
    5. In the upper-right corner, select Subscribe to the new projects feed ({rss}).
  • From a project:

    1. On the left sidebar, at the top, select Search GitLab ({search}) to find your project.
    2. In the Project overview page, from the Topics list select the topic you want to subscribe to.
    3. In the upper-right corner, select Subscribe to the new projects feed ({rss}).

The results are displayed as an RSS feed in Atom format. The URL of the result contains a feed token and the list of projects that have the topic. You can add this URL to your feed reader.

Assign a topic to a project

You can assign topics to a project on the Project Settings page.

Administer topics

Instance administrators can administer all project topics from the Admin Area's Topics page.

Star a project

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

To add a star to a project:

  1. On the left sidebar, at the top, select Search GitLab ({search}) to find your project.
  2. In the upper-right corner of the page, select Star.

Delete a project

After you delete a project:

To delete a project:

  1. On the left sidebar, at the top, select Search GitLab ({search}) to find your project.
  2. Select Settings > General.
  3. Expand the Advanced section.
  4. Scroll down to the Delete project section.
  5. Select Delete project.
  6. Confirm this action by completing the field.

View projects pending deletion (PREMIUM)

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

  1. On the left sidebar, expand the top-most chevron ({chevron-down}).
  2. Select View all your projects.
  3. 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.

Each project in the list shows:

  • 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.

View project activity

To view the activity of a project:

  1. On the left sidebar, at the top, select Search GitLab ({search}) to find your project.

  2. Select Manage > Activity.

  3. Optional. To filter activity by contribution type, select a tab:

    • All: All contributions by project members.
    • Push events: Push events in the project.
    • Merge events: Accepted merge requests in the project.
    • Issue events: Issues opened and closed in the project.
    • Comments: Comments posted by project members.
    • Designs: Designs added, updated, and removed in the project.
    • Team: Members who joined and left the project.

Search in projects

To search through your projects, on the left sidebar, at the top, select Search GitLab ({search}). GitLab filters as you type.

You can also look for the projects you starred (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.

Filter projects by language

You can filter projects by the programming language they use. To do this:

  1. On the left sidebar, expand the top-most chevron ({chevron-down}).
  2. Select either:
    • View all your projects, to filter your projects.
    • Explore, to filter all projects you can access.
  3. 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.

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 left sidebar, at the top, select Search GitLab ({search}) to find your project.
  2. Select Settings > General.
  3. Expand Visibility, project features, permissions.
  4. Use the toggle by each feature you want to turn on or off, or change access for.
  5. Select Save changes.

Access the Project overview page by using the project ID

Introduced in GitLab 11.8.

To access a project by using the project ID instead of its name, go to https://gitlab.example.com/projects/:id.

The project ID is displayed in the Project overview page, under the project name.

For example, if in your personal namespace alex you have a project my-project with the ID 123456, you can access the project either at https://gitlab.example.com/alex/my-project or https://gitlab.example.com/projects/123456.

Who can view the Project overview page

When you select a project, the Project overview page shows the project contents.

For public projects, and members of internal and private projects with permissions to view the project's code, the project landing page shows:

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

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

Leave a project

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.

To leave a project:

  1. On the left sidebar, at the top, select Search GitLab ({search}) to find your project.
  2. Select Leave project. The Leave project option only displays on the project dashboard when a project is part of a group under a group namespace.

Use a project as a Go package

Prerequisites:

  • Contact your administrator to enable the GitLab Go Proxy.
  • To use a private project in a subgroup as a Go package, you must authenticate Go requests. Go requests that are not authenticated cause 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:

Authenticate Go requests to private projects

Prerequisites:

  • Your GitLab instance must be accessible with HTTPS.
  • You must have a personal access token with read_api scope.

To authenticate Go requests, create a .netrc file with the following information:

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

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

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.

Authenticate Git requests

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.

Configure Git to either:

  • Embed credentials in the request URL:

    git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"
  • Use SSH instead of HTTPS:

    git config --global url."[email protected]:".insteadOf "https://gitlab.example.com/"

Disable Go module fetching for private projects

To fetch modules or packages, Go uses the environment variables:

  • 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.
  2. Disable proxy queries in GONOPROXY.
  3. Disable checksum queries in GONOSUMDB.
  • If the module name or its prefix is in GOPRIVATE or GONOPROXY, Go does not query module proxies.
  • If the module name or its prefix is in GONOPRIVATE or GONOSUMDB, Go does not query Checksum databases.

Fetch Go modules from Geo secondary sites

Use Geo 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:

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

    git config --global url."[email protected]".insteadOf "https://gitlab.example.com"
    git config --global url."[email protected]".insteadOf "http://gitlab.example.com"
    • For gitlab.example.com, use the primary site domain name.
    • For gitlab-secondary.example.com, use the secondary site domain name.
  2. 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.

Use HTTP to access the Geo secondary

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.

To access the Geo secondary server with HTTP:

  1. Add a Git insteadOf redirect on the client:

    git config --global url."https://gitlab-secondary.example.com".insteadOf "https://gitlab.example.com"
    • For gitlab.example.com, use the primary site domain name.
    • For gitlab-secondary.example.com, use the secondary site domain name.
  2. Generate a personal access token and add the credentials in the client's ~/.netrc file:

    machine gitlab.example.com login USERNAME password TOKEN
    machine gitlab-secondary.example.com login USERNAME password TOKEN

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.

Related topics

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, you can find and store an array of projects based on a SQL query:

# 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 and one of the following:

WARNING: 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.

## 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 and run the following:

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.

WARNING: 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.

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:

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, you may need to do this for a large number of projects.

To toggle a specific feature, you can start a Rails console session and run the following function:

WARNING: 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.

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.