Cake_Git icon indicating copy to clipboard operation
Cake_Git copied to clipboard

Provide an overload to push to untracked refSpecs

Open mdmoura opened this issue 8 years ago • 1 comments

I am executing the following command on a Cake build script: GitPush(".", "username", "password", "master");

And I get the following error: LibGit2Sharp.LibGit2SharpException: The branch 'master' ("refs/heads/master") that you are trying to push does not track an upstream branch.

After it I just run it manually on the command line using: git push origin master

And in this case it is pushed. What might be wrong?

mdmoura avatar Aug 01 '17 17:08 mdmoura

Sorry for the late response. The description of the method you are using is

Push specific branch authenticated.

So, this method updates a tracked remote ref using a local ref. The error you received was

The branch 'master' ("refs/heads/master") that you are trying to push does not track an upstream branch.

Which means the local ref does not track a remote ref to update and hence libgit does not know "where" to push to.

On the other hand, the "working" command you provided correlates to git push <repository> <refspec> which updates the defined refs (from refspec) in the defined repository.

So what you are looking for is the currently not existing equivalent of Network.Push(Remote, string, string, PushOptions).

nils-a avatar Jun 09 '21 21:06 nils-a