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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
839829a7
Commit
839829a7
authored
Jan 31, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds documentation for the feature
parent
dc229c07
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
doc/gitlab-basics/create-project.md
doc/gitlab-basics/create-project.md
+38
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+6
-2
No files found.
doc/gitlab-basics/create-project.md
View file @
839829a7
...
...
@@ -33,5 +33,43 @@
1.
Click
**Create project**
.
## Push to create a new project
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/26388) in GitLab 10.5.
When you create a new repo locally, instead of going to GitLab to manually
create a new project and then push the repo, you can directly push it to
GitLab to create the new project, all without leaving your terminal. That
will automatically create a new project under a GitLab namespace that you have access to
with its visibility set to private by default (you can later change it).
This can be done by using either SSH or HTTP:
```
## Git push using SSH
git push git@gitlab.com:namespace/nonexistent-project.git branch_name
## Git push using HTTP
git push https://gitlab.com/namespace/nonexistent-project.git branch_name
```
Once the push finishes successfully, a remote message will indicate
the command to set the remote and the URL to the new project:
```
remote:
remote: The private project namespace/nonexistent-project was created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.com/namespace/nonexistent-project.git
remote:
remote: To view the project, visit:
remote: https://gitlab.com/namespace/nonexistent-project
remote:
```
If the project name is already in use, your push will be rejected
to prevent accidental overwriting the existing project.
[
import it
]:
../workflow/importing/README.md
[
reserved
]:
../user/reserved_names.md
lib/gitlab/git_access.rb
View file @
839829a7
...
...
@@ -2,6 +2,8 @@
# class return an instance of `GitlabAccessStatus`
module
Gitlab
class
GitAccess
include
Gitlab
::
Utils
::
StrongMemoize
UnauthorizedError
=
Class
.
new
(
StandardError
)
NotFoundError
=
Class
.
new
(
StandardError
)
ProjectCreationError
=
Class
.
new
(
StandardError
)
...
...
@@ -239,10 +241,12 @@ module Gitlab
end
def
can_create_project_in_namespace?
(
cmd
)
strong_memoize
(
:can_create_project_in_namespace
)
do
return
false
unless
push?
(
cmd
)
&&
target_namespace
&&
project
.
blank?
user
.
can?
(
:create_projects
,
target_namespace
)
end
end
def
http?
protocol
==
'http'
...
...
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