Create a project with git push
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
You can use git push
to add a local project repository to GitLab. After you add a repository,
GitLab creates your project in your chosen namespace.
You cannot use git push
to create projects with paths that were previously used or
renamed.
Previously used project paths have a redirect. Instead of creating a new project,
the redirect causes push attempts to redirect requests to the renamed project location.
To create a new project for a previously used or renamed project, use the UI
or the Projects API.
Prerequisites:
You must have permission to add new projects to a namespace. To verify your permissions:
- On the left sidebar, select Search or go to and find your group.
- In the upper-right corner, confirm that New project is visible.
If you do not have the necessary permission, contact your GitLab administrator.
To create a project with git push
:
Push your local repository to GitLab with one of the following:
With SSH:
If your project uses the standard port 22, run:
git push --set-upstream git@gitlab.example.com:namespace/myproject.git main
If your project requires a non-standard port number, run:
git push --set-upstream ssh://git@gitlab.example.com:00/namespace/myproject.git main
With HTTP, run:
git push --set-upstream https://gitlab.example.com/namespace/myproject.git master
Replace the following values:
gitlab.example.com
with the machine domain name hosts your Git repository.namespace
with your namespace name.myproject
with your project name.- If specifying a port, change
00
to your project’s required port number. - Optional. To export existing repository tags, append the
--tags
flag to yourgit push
command.
Optional. Configure the remote:
git remote add origin https://gitlab.example.com/namespace/myproject.git
When the git push
operation completes, GitLab displays the following message:
remote: The private project namespace/myproject was created.
To view your new project, go to https://gitlab.example.com/namespace/myproject
.
By default, your project’s visibility is set to Private,
but you can change the project’s visibility.
Related topics
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support