Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

How to create a new repo programmatically #1280

@rjdsd

Description

@rjdsd

I am trying to create a new Repo through this API on bitbucket

Following is the pseudocode

       newRepoURL :=  "ssh://git@ourbitbucket:port/myproject/myApp.git"
       r, err := git.PlainInit(newRepoURL, false)
       w, err := r.Worktree()
       filename := filepath.Join(newRepoURL, "example-git-file")
       _, err = w.Add("example-git-file")
       commit, err := w.Commit("init commit to new repo", &git.CommitOptions{
                                 Auth : auth
                                 }
        remote, err := r.CreateRemote(&config.RemoteConfig{
			Name: "myApp",
			URLs: []string{newRepoURL},
		         })
        err = remote.Push(&git.PushOptions{
			RemoteName: "myApp",
			Auth:auth,
		         }) 

But I get following error

unknown error: Repository not found

Could anyone help where I am going wrong here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions