Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d477f0c7
Commit
d477f0c7
authored
Jul 26, 2021
by
Amy Qualls
Committed by
Igor Drozdov
Jul 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revise push-locally instructions
parent
0ede1d4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
33 deletions
+38
-33
doc/user/project/working_with_projects.md
doc/user/project/working_with_projects.md
+38
-33
No files found.
doc/user/project/working_with_projects.md
View file @
d477f0c7
...
...
@@ -148,39 +148,44 @@ To use a custom project template on the **New project** page:
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/26388) in GitLab 10.5.
When you create a new repository locally, instead of manually creating a new project in GitLab
and then
[
cloning the repository
](
../../gitlab-basics/start-using-git.md#clone-a-repository
)
locally, you can directly push it to GitLab to create the new project, all without leaving
your terminal. If you have access rights to the associated namespace, GitLab
automatically creates a new project under that GitLab namespace with its visibility
set to Private by default (you can later change it in the
[
project's settings
](
../../public_access/public_access.md#change-project-visibility
)
).
This can be done by using either SSH or HTTPS:
```
shell
## Git push using SSH
git push
--set-upstream
git@gitlab.example.com:namespace/nonexistent-project.git master
## Git push using HTTPS
git push
--set-upstream
https://gitlab.example.com/namespace/nonexistent-project.git master
```
You can pass the flag
`--tags`
to the
`git push`
command to export existing repository tags.
Once the push finishes successfully, a remote message indicates
the command to set the remote and the URL to the new project:
```
plaintext
remote:
remote: The private project namespace/nonexistent-project was created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.example.com/namespace/nonexistent-project.git
remote:
remote: To view the project, visit:
remote: https://gitlab.example.com/namespace/nonexistent-project
remote:
```
When you create a new repository locally, you don't have to sign in to the GitLab
interface to create a project and
[
clone its repository
](
../../gitlab-basics/start-using-git.md#clone-a-repository
)
.
You can directly push your new repository to GitLab, which creates your new project
without leaving your terminal.
To push a new project:
1.
Identify the
[
namespace
](
../group/index.md#namespaces
)
you want to add the new
project to, as you need this information in a future step. To determine if you have
permission to create new projects in a namespace, view the group's page in a
web browser and confirm the page displays a
**New project**
button.
NOTE:
As project creation permissions can have many factors, contact your
GitLab administrator if you're unsure.
1.
If you want to push using SSH, ensure you have
[
created a SSH key
](
../../ssh/README.md
)
and
[
added it to your GitLab account
](
../../ssh/index.md#add-an-ssh-key-to-your-gitlab-account
)
.
1.
Push with one of the following methods. Replace
`gitlab.example.com`
with the
domain name of the machine that hosts your Git repository,
`namespace`
with the name of
your namespace, and
`myproject`
with the name of your new project:
-
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`
Optional: to export existing repository tags, append the
`--tags`
flag to your
`git push`
command.
1.
When the push completes, GitLab displays a message:
```
plaintext
remote: The private project namespace/myproject was created.
```
1.
(Optional) To configure the remote, alter the command
`git remote add origin https://gitlab.example.com/namespace/myproject.git`
to match your namespace and project names.
You can view your new project at
`https://gitlab.example.com/namespace/myproject`
.
Your project's visibility is set to
**Private**
by default, but you can change it
in your
[
project's settings
](
../../public_access/public_access.md#change-project-visibility
)
).
## Fork a project
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment