Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Add remoteName flag to glab repo create #850

Merged
merged 1 commit into from
Oct 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion commands/project/create/project_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command {
projectCreateCmd.Flags().StringP("group", "g", "", "Namespace/group for the new project (defaults to the current user’s namespace)")
projectCreateCmd.Flags().StringP("description", "d", "", "Description of the new project")
projectCreateCmd.Flags().String("defaultBranch", "", "Default branch of the project. If not provided, `master` by default.")
projectCreateCmd.Flags().String("remoteName", "origin", "Remote name for the Git repository you're in. If not provided, `origin` by default.")
projectCreateCmd.Flags().StringArrayP("tag", "t", []string{}, "The list of tags for the project.")
projectCreateCmd.Flags().Bool("internal", false, "Make project internal: visible to any authenticated user (default)")
projectCreateCmd.Flags().BoolP("private", "p", false, "Make project private: visible only to project members")
Expand All @@ -72,6 +73,10 @@ func runCreateProject(cmd *cobra.Command, args []string, f *cmdutils.Factory) er
if err != nil {
return err
}
remoteName, err := cmd.Flags().GetString("remoteName")
if err != nil {
return err
}
err = initGit(defaultBranch)
if err != nil {
return err
Expand Down Expand Up @@ -175,7 +180,7 @@ func runCreateProject(cmd *cobra.Command, args []string, f *cmdutils.Factory) er
protocol, _ := cfg.Get(webURL.Host, "git_protocol")

remote := glrepo.RemoteURL(project, protocol)
_, err = git.AddRemote("origin", remote)
_, err = git.AddRemote(remoteName, remote)
if err != nil {
return err
}
Expand Down