Skip to content

How to create a job with init README? #765

Closed

Description

@Tiger-zzZ

Description of the problem, including code/CLI snippet

I want to use gitlab project create ... to create a job and Initialize repository with a README,
but there is no options.
gitlab api https://docs.gitlab.com/ee/api/projects.html#create-project in create job has option initialize_with_readme.
in the last i use this command create README .gitlab project-file create --project-id $(shell cat REPO_INFO | grep 'id' | sed 's/^id: //g') --file-path README.md --branch master --content '# makefile-init' --commit-message init-with-makefile
if there has better choice?

Expected Behavior

Actual Behavior

Specifications

  • python-gitlab version:
  • API version you are using (v3/v4):
  • Gitlab server version (or gitlab.com):

Activity

  1. nejch commented on Apr 7, 2020

    @nejch
    Member

    Hi @Tiger-zzZ, this is quite late but there are two options:

    1. If you just need a placeholder README so that you have a clonable repo with a master branch, then the following will be enough after fix(project): add missing project parameters #1067 is merged:
    gitlab project create --path "your-repo" --initialize-with-readme true
    
    1. If you need specific content, as shown in your post above with --content 'your content', then I think your approach makes sense. The GitLab API (or UI) does not provide a way to already provide the content of the readme when creating projects with READMEs initialized.
  2. locked as resolved and limited conversation to collaborators on Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions