Text of docs.gitlab.com › user › project › repository as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Repository | GitLab Docs

/ Repository Tier : Free, Premium, Ultimate Offering : GitLab.com, GitLab Self-Managed, GitLab Dedicated Your repository is a component of your GitLab project. You store your code in your repository, and track changes to it with version control. Each repository is part of a GitLab project , and cannot exist without a GitLab project. Your project provides the configuration options for your repository. Create a repository To create a repository: Create a project or Fork an existing project .

Add files to a repository You can add files to a repository: When you create a project , or After you create a project, using the following options: Web editor . User Interface (UI) . Command line . Add a file from the UI To add or upload a file from the GitLab UI: In the top bar, select Search or go to and find your project. Go to the directory you want to upload the file to. Next to the directory name, select the plus icon ( ) > Upload file .

Drop or upload your file. Enter a commit message. Optional. To create a merge request with your changes, in Target branch , enter a branch name that’s not your repository’s default branch . Select Upload file . Commit changes to a repository You can commit your changes to a branch in the repository. When you use the command line, use git commit . For information about how to use commits to improve communication and collaboration, trigger or skip pipelines, and reverting changes, see commits .

Clone a repository You can clone a repository using the: Command line: Clone with SSH : Use SSH if you have SSH keys configured and want to authenticate without entering credentials for each operation. Clone with HTTPS : Use HTTPS if you prefer to authenticate with a personal access token or if your network blocks SSH connections. GitLab UI: Clone and open in Apple Xcode Clone and open in Visual Studio Code Clone and open in IntelliJ IDEA Download repository source code To download a repository’s source code as a compressed file: In the top bar, select Search or go to and find your project.

Above the file list, select Code . From the options, select the files you want to download: Source code : Download the source code from the current branch you’re viewing. Available extensions: zip , tar , tar.gz , and tar.bz2 . Directory : Download a specific directory. Visible only when you view a subdirectory. Available extensions: zip , tar , tar.gz , and tar.bz2 . Artifacts : Download the artifacts from the latest CI/CD job.

The checksums of generated archives can change even if the repository itself doesn’t change. For example, this occurs if Git or a third-party library that GitLab uses changes. Do not use an archive checksum to confirm that two downloads contain the same repository contents. Instead, verify contents with signed commits and tags . View repository by Git revision To view all repository files and folders at a specific Git revision, such as a commit SHA, branch name, or tag: In the top bar, select Search or go to and find your project.

At the top, select to open the Select Git revision dropdown list. Select or search for a Git revision. You can also view and browse files at a specific Git revision from the commits page. Repository languages GitLab detects programming languages used in the default branch. This information is displayed on the Project overview page. When new files are added, this information can take up to five minutes to update. Add repository languages Not all files are detected and listed on the Project overview page.

Documentation, vendor code, and most markup languages are excluded. To view a list of supported files and languages, see supported data types . To change this behavior and include additional file types in the default settings: In your repository’s root directory, create a file named .gitattributes . Add a line that tells GitLab to include a specific file type. For example, to enable .proto files, add the following: *.proto linguist-detectable=true This feature can use excessive CPU.

If you experience an issue, see the excessive CPU use troubleshooting section. Repository license GitLab detects the license for a project from a file such as LICENSE or COPYING in the root of the default branch. When the root has more than one license file, GitLab prefers LICENSE , COPYING , and their .md or .txt versions over a variant such as LICENSE-3RD-PARTY.md . GitLab displays the detected license on the project overview and when you view the license file.

GitLab compares the license text against the SPDX License List. If the text does not match a license in that list, the project overview shows LICENSE , and the license file view shows Other . License templates , including custom instance and group templates, do not affect license detection. Repository contributor analytics You can view a line chart with the number of commits to the selected project branch over time, and line charts with the number of commits by each project member.

For more information, see contributor analytics . Repository history graph A repository graph displays a visual history of the repository network, including branches and merges. This graph helps you see the flow of changes in the repository. To view the repository history graph, go to your project’s Code > Repository graph . Repository path changes When a repository path changes, GitLab handles the transition from the old location to the new one with a redirect.

When you rename a user , change a group path , or rename a repository : URLs for the namespace and everything under it, like projects, are redirected to the new URLs. Git remote URLs for projects under the namespace redirect to the new remote URL. When you push or pull to a repository that has changed location, a warning message to update your remote is displayed. Automation scripts or Git clients continue to work after a rename.

The redirects are available as long as the original path is not claimed by another group, user, or project. API redirects might need to be followed explicitly. After you change a path, you must update the existing URL in the following resources: Include statements except include:component , otherwise pipelines fail with a syntax error. CI/CD component references can follow redirects. Namespaced API calls that use the encoded path instead of the numeric namespace and project IDs.

Docker image references . Variables that specify a project or namespace. CODEOWNERS file . Related topics GitLab for VS Code extension Lock files and prevent change conflicts Repository API Files Branches Create a directory Find file history Identify changes by line (Git blame) Troubleshooting Search sequence of pushes to a repository If it seems that a commit has gone “missing”, search the sequence of pushes to a repository.

This Stack Overflow thread describes how you can end up in this state without a force push. Another cause can be a misconfigured server hook that changes a HEAD ref in a git reset operation. If you look at the output from the sample code below for the target branch, you see a discontinuity in the from/to commits as you step through the output. The commit_from of each new push should equal the commit_to of the previous push.

A break in that sequence indicates one or more commits have been “lost” from the repository history. Using the rails console , the following example checks the last 100 pushes and prints the commit_from and commit_to entries: ruby p = Project . find_by_full_path ( 'project/path' ) p . events . pushed_action . last ( 100 ) . each do | e | printf "%-20.20s %8s...%8s (%s)" , e . push_event_payload [ :ref ] , e . push_event_payload [ :commit_from ] , e . push_event_payload [ :commit_to ] , e . author . try ( :username ) end ; nil Example output showing break in sequence at line 4: master f21b07713251e04575908149bdc8ac1f105aabc3...6bc56c1f46244792222f6c85b11606933af171de root master 6bc56c1f46244792222f6c85b11606933af171de...132da6064f5d3453d445fd7cb452b148705bdc1b ro

The rest of this page is on the live site.