code.gitea.io/gitea@v1.22.3/docs/content/usage/push.en-us.md (about)

     1  ---
     2  date: "2020-07-06T16:00:00+02:00"
     3  title: "Push"
     4  slug: "push"
     5  sidebar_position: 15
     6  toc: false
     7  draft: false
     8  aliases:
     9    - /en-us/push-to-create
    10    - /en-us/push-options
    11  menu:
    12    sidebar:
    13      parent: "usage"
    14      name: "Push"
    15      sidebar_position: 15
    16      identifier: "push"
    17  ---
    18  
    19  There are some additional features when pushing commits to Gitea server.
    20  
    21  # Open PR through Push
    22  
    23  When you push commits to a non-default branch for the first time,
    24  you will receive a link you can click on to visit the compare page of your branch compared to your main branch.
    25  From there, it's easy to create a pull request, even if you want to target another branch.
    26  
    27  ![Gitea Push Hint](/gitea-push-hint.png)
    28  
    29  # Push Options
    30  
    31  In Gitea `1.13`, support for some [push options](https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt)
    32  were added.
    33  
    34  ## Supported Options
    35  
    36  - `repo.private` (true|false) - Change the repository's visibility.
    37  
    38    This is particularly useful when combined with push-to-create.
    39  
    40  - `repo.template` (true|false) - Change whether the repository is a template.
    41  
    42  Example of changing a repository's visibility to public:
    43  
    44  ```shell
    45  git push -o repo.private=false -u origin main
    46  ```
    47  
    48  # Push To Create
    49  
    50  Push to create is a feature that allows you to push to a repository that does not exist yet in Gitea. This is useful for automation and for allowing users to create repositories without having to go through the web interface. This feature is disabled by default.
    51  
    52  ## Enabling Push To Create
    53  
    54  In the `app.ini` file, set `ENABLE_PUSH_CREATE_USER` to `true` and `ENABLE_PUSH_CREATE_ORG` to `true` if you want to allow users to create repositories in their own user account and in organizations they are a member of respectively. Restart Gitea for the changes to take effect. You can read more about these two options in the [Configuration Cheat Sheet](administration/config-cheat-sheet.md#repository-repository).
    55  
    56  ## Using Push To Create
    57  
    58  Assuming you have a git repository in the current directory, you can push to a repository that does not exist yet in Gitea by running the following command:
    59  
    60  ```shell
    61  # Add the remote you want to push to
    62  git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
    63  
    64  # push to the remote
    65  git push -u origin main
    66  ```
    67  
    68  This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.
    69  
    70  Push-to-create will default to the visibility defined by `DEFAULT_PUSH_CREATE_PRIVATE` in `app.ini`.