24 KiB
stage | group | info |
---|---|---|
Manage | Workspace | 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 projects
To view projects, on the top bar, select Main menu > Projects > View all projects.
NOTE: The Explore projects tab is visible to unauthenticated users unless the Public visibility level is restricted. Then the tab is visible only to signed-in users.
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, the project landing page shows:
- A
README
or index file. - 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 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.
Explore topics
To explore project topics:
- On the top bar, select Main menu > Projects > View all projects.
- Select the Explore topics tab.
- 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.
You can assign topics to a project on the Project Settings page.
If you're an instance administrator, you can administer all project topics from the Admin Area's Topics page.
Create a project
To create a project in GitLab:
- On the top bar, select Main menu > Projects > View all projects.
- On the right of the page, select New project.
- Select an option:
- Create a blank project.
- Create a project from a:
- Import a project from a different repository. Contact your GitLab administrator if this option is not available.
- Connect an external repository to GitLab CI/CD.
- For a list of words that you cannot use as project names, see reserved project and group names.
- For a list of characters that you cannot use in project and group names, see limitations on project and group names.
Create a blank project
To create a blank project:
- On the top bar, select Main menu > Projects > View all projects.
- On the right of the page, select New project.
- Select Create blank project.
- Enter the project details:
- 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.
- 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.
- In the Project deployment target (optional) field, select your project's deployment target. This information helps GitLab better understand its users and their deployment requirements.
- To modify the project's viewing and access rights for users, change the Visibility Level.
- 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.
- To analyze the source code in the project for known security vulnerabilities, select Enable Static Application Security Testing (SAST).
- 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:
Anyone can contribute a built-in template.
To create a project from a built-in template:
- On the top bar, select Main menu > Projects > View all projects.
- On the right of the page, select New project.
- Select Create from template.
- Select the Built-in tab.
- From the list of templates:
- To view a preview of the template, select Preview.
- To use a template for the project, select Use template.
- Enter the project details:
- 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.
- 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.
- In the Project description (optional) field, enter the description of your project's dashboard.
- To modify the project's viewing and access rights for users, change the Visibility Level.
- Select Create project.
Create a project from a custom template (PREMIUM)
Introduced in GitLab 11.2.
Custom project templates are available at:
- The instance-level
- The group-level
- On the top bar, select Main menu > Projects > View all projects.
- On the right of the page, select New project.
- Select Create from template.
- Select the Instance or Group tab.
- From the list of templates:
- To view a preview of the template, select Preview.
- To use a template for the project, select Use template.
- Enter the project details:
- 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.
- 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.
- The description of your project's dashboard in the Project description (optional) field.
- To modify the project's viewing and access rights for users, change the Visibility Level.
- Select Create project.
Create a project from the HIPAA Audit Protocol template (ULTIMATE)
Introduced in GitLab 12.10
The HIPAA Audit Protocol template contains issues for audit inquiries in the HIPAA Audit Protocol published by the U.S Department of Health and Human Services.
To create a project from the HIPAA Audit Protocol template:
- On the top bar, select Main menu > Projects > View all projects.
- On the right of the page, select New project.
- Select Create from template.
- Select the Built-in tab.
- 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.
- Enter the project details:
- 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.
- 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.
- In the Project description (optional) field, enter the description of your project's dashboard.
- To modify the project's viewing and access rights for users, change the Visibility Level.
- Select Create project.
Create a new project with Git push
Introduced in GitLab 10.5.
Use git push
to push a local project repository to GitLab. After you push a repository,
GitLab creates your project in your chosen namespace.
You cannot use git push
to create projects with project paths that:
- Have previously been used.
- Have been renamed.
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 used or renamed project, use the UI or the Projects API.
Prerequisites:
-
To push with SSH, you must have an SSH key that is added to your GitLab account.
-
You must have permission to add new projects to a namespace. To check if you have permission:
- On the top bar, select Main menu > Groups and find your group.
- Confirm that New project is visible in the upper right corner. Contact your GitLab administrator if you require permission.
To push your repository and create a project:
-
Push with SSH or HTTPS:
-
To push with SSH:
git push --set-upstream git@gitlab.example.com:namespace/myproject.git master
-
To push with HTTPS:
git push --set-upstream https://gitlab.example.com/namespace/myproject.git master
-
For
gitlab.example.com
, use the domain name of the machine that hosts your Git repository. -
For
namespace
, use the name of your namespace. -
For
myproject
, use the name of your project. -
Optional. To export existing repository tags, append the
--tags
flag to yourgit push
command.
-
-
Optional. To configure the remote:
git remote add origin https://gitlab.example.com/namespace/myproject.git
When the push completes, GitLab displays the message:
remote: The private project namespace/myproject was created.
To view your new project, go to https://gitlab.example.com/namespace/myproject
.
Your project's visibility is set to Private by default. To change project visibility, adjust your
project's settings.
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:
- On the top bar, select Main menu > Projects and find your project.
- In the upper right corner of the page, select Star.
View starred projects
-
On the top bar, select Main menu > Projects > View all projects.
-
Select the Starred projects tab.
-
GitLab displays information about your starred projects, including:
- 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.
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:
- On the top bar, select Main menu > Projects > View all projects.
- In the Your projects tab, select Personal.
Delete a project
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.
To delete a project:
- On the top bar, select Main menu > Projects and find your project.
- Select Settings > General.
- Expand the Advanced section.
- Scroll down to the Delete project section.
- Select Delete project.
- Confirm this action by completing the field.
View projects pending deletion (PREMIUM)
- Introduced in GitLab 13.3 for Administrators.
- Tab renamed from Deleted projects in GitLab 14.6.
- Available to all users in GitLab 14.8 with a flag named
project_owners_list_project_pending_deletion
. Enabled by default.- Generally available in GitLab 14.9. Feature flag
project_owners_list_project_pending_deletion
removed.
When delayed project deletion is enabled for a group, projects within that group are not deleted immediately, but only after a delay.
To view a list of all projects that are pending deletion:
- On the top bar, select Main menu > Projects > View all projects.
- 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:
- On the top bar, select Main menu > Projects and find your project..
- On the left sidebar, select Project information > Activity.
- Select a tab to view the type of project activity.
Search in projects
You can search through your projects.
- On the top bar, select Main menu.
- In Search your projects, type the project name.
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.
Leave a project
If you leave a project, you are no longer a project member and cannot contribute.
To leave a project:
- On the top bar, select Main menu > Projects and find your project.
- 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."git@gitlab.example.com:".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:
- 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
.
- To disable queries for one project, disable
- Disable proxy queries in
GONOPROXY
. - Disable checksum queries in
GONOSUMDB
.
- If the module name or its prefix is in
GOPRIVATE
orGONOPROXY
, Go does not query module proxies. - If the module name or its prefix is in
GONOPRIVATE
orGONOSUMDB
, 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:
-
Reconfigure Git on the client to send traffic for the primary to the secondary:
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"
- For
gitlab.example.com
, use the primary site domain name. - For
gitlab-secondary.example.com
, use the secondary site domain name.
- For
-
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:
-
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.
- For
-
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
- Import a project.
- Connect an external repository to GitLab CI/CD.
- Fork a project.
- Adjust project visibility and access levels.
- Limitations on project and group names
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: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.
## 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: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.
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: Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.
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.