0

I tried to push the refspec without src defined and it doesn't remove the remote branch. Here's what my code look like

var refs = [
    ':refs/remotes/origin/branch-a'
];

Git.Repository.open(workingPath)
    .then((repository) => {
        return repository.getRemote('origin')
    })
    .then((remote) => {

        return remote.push(refs, {
            callbacks: {
                credentials: function(url, userName) {
                    return Git.Cred.userpassPlaintextNew(username, password)
                }
            }
        })
    })
    .then(() => {
        console.log('done');
    })
    .catch((err) => {
        console.log(`Error: ${err}`);
    }) 

The result in my console:

done

Do you have any suggestion how I could remove the remote branch? thanks

m0xx
  • 1
  • 2
  • "it doesn't work" means nothing, you have to be more specific, show at least the error message. Check this: http://stackoverflow.com/help/how-to-ask – Marcs Oct 27 '16 at 21:39
  • thanks! Do you have any idea how to solve the problem? – m0xx Oct 27 '16 at 22:07

1 Answers1

0

Push an empty src reference to the origin branch, like:

remote.push(':refs/heads/my-branch');//it's a string not an array

For your code set refs:

var refs = ':refs/remotes/origin/branch-a';
wikola
  • 111
  • 3