Commit 651e25b2 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'bcarranza-master-patch-27605' into 'master'

Add snippet on how to export a project to GitLab Rails Console Cheat Sheet

See merge request gitlab-org/gitlab!50000
parents 4c39e054 8f95368b
......@@ -374,6 +374,26 @@ Clear the cache:
sudo gitlab-rake cache:clear
```
### Export a repository
It's typically recommended to export a project through [the web interface](../../user/project/settings/import_export.md#exporting-a-project-and-its-data) or through [the API](../../api/project_import_export.md). In situations where this is not working as expected, it may be preferable to export a project directly via the Rails console:
```ruby
user = User.find_by_username('USERNAME')
project = Project.find_by_full_path('PROJECT_PATH')
Projects::ImportExport::ExportService.new(project, user).execute
```
If the project you wish to export is available at `https://gitlab.example.com/baltig/pipeline-templates`, the value to use for `PROJECT_PATH` would be `baltig/pipeline-templates`.
If this all runs successfully, you will see output like the following before being returned to the Rails console prompt:
```ruby
=> nil
```
The exported project will be located within a `.tar.gz` file in `/var/opt/gitlab/gitlab-rails/uploads/-/system/import_export_upload/export_file/`.
## Repository
### Search sequence of pushes to a repository
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment