File: _empty_git_instructions.html.haml

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (46 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- default_branch_name = @project.default_branch_or_main
- escaped_default_branch_name = default_branch_name.shellescape

- git_push_target = ''
- if protocol == 'ssh'
  - ssh_doc = link_to('', help_page_path('user/ssh.md'), target: '_blank', rel: 'noopener noreferrer')
  %p.gl-mt-2= safe_format(_('%{link}How to use SSH keys%{link_end}?'), tag_pair(ssh_doc, :link, :link_end))
  - git_push_target = content_tag(:span, ssh_clone_url_to_repo(@project), class: 'js-clone')
- if protocol == 'https'
  - git_push_target = content_tag(:span, http_clone_url_to_repo(@project), class: 'js-clone')
- if protocol == 'kerberos'
  - git_push_target = content_tag(:span, @project.kerberos_url_to_repo, class: 'js-clone')

%h4.gl-text-base= _('Create a new repository')
%pre.code.js-syntax-highlight
  :preserve
    git clone #{git_push_target}
    cd #{h @project.path}
    git switch --create #{h escaped_default_branch_name}
    touch README.md
    git add README.md
    git commit -m "add README"
  - if @project.can_current_user_push_to_default_branch?
    %span><
      git push --set-upstream origin #{h escaped_default_branch_name}
%h4.gl-text-base= _('Push an existing folder')
%pre.code.js-syntax-highlight
  :preserve
    cd existing_folder
    git init --initial-branch=#{h escaped_default_branch_name}
    git remote add origin #{git_push_target}
    git add .
    git commit -m "Initial commit"
  - if @project.can_current_user_push_to_default_branch?
    %span><
      git push --set-upstream origin #{h escaped_default_branch_name}
%h4.gl-text-base= _('Push an existing Git repository')
%pre.code.js-syntax-highlight
  :preserve
    cd existing_repo
    git remote rename origin old-origin
    git remote add origin #{git_push_target}
  - if @project.can_current_user_push_to_default_branch?
    %span><
      git push --set-upstream origin --all
      git push --set-upstream origin --tags