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

How to create a new repo programmatically #1280

Open
rjdsd opened this issue Jan 24, 2020 · 0 comments
Open

How to create a new repo programmatically #1280

rjdsd opened this issue Jan 24, 2020 · 0 comments

Comments

@rjdsd
Copy link

rjdsd commented Jan 24, 2020

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant