3

I'm using a single github repo for CI work. My app receives a zip file, I create a repo locally, commit my files to the master branch, add the origin remote and then try to push to github.

Since files already exist in the github repo, I get the error, "[Error: Cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.]"

Does nodegit support pushing to the remote with the --force flag to overwrite everything? I've looked through the docs and can't find it.

Thanks! Jeff

Jeff Douglas
  • 191
  • 1
  • 7

1 Answers1

3

NodeGit supports passing refspecs into the remote. So you could do a force push to master by adding a + to the front of the refspec.

Example: remote.push('+refs/heads/master:remotes/origin/master', null, mySignature, myMessage)

johnhaley81
  • 1,153
  • 10
  • 14