Like many Magit commands, the push commands are not really intended to be used non-interactively.
Currently no warning is shown if you use them non-interactively, but that might change. The commands are not considered part of any application programming interface, and I don't make any promises about their "interfaces" staying the same.
Anyway, assuming you know elisp and are also somewhat familiar with Emacs programming concepts (in particular how commands work), then I would assume it to be fairly obvious what you have to do, after looking at the various push commands:
(let ((default-directory "/path/to/local/repo/"))
Of course you should also handle the cases when there is no current branch or when it has no upstream. Again, look at
magit-push-current-to-upstream for one way of doing that. And since you don't actually want to push to the upstream (I believe), you'll have to adjust that part too.
But what determines the current branch, and how can I specify it?
Look at the code, specifically inside the
interactive form; there
magit-get-current-branch is being called. That then becomes the value of the
BRANCH argument, but only when the command is being called interactively. When it is being called non-interactively as in
(magit-push-current-to-upstream ...), then the
interactive form is irrelevant, and you have to provide the arguments yourself, which makes it kind of pointless to use this command/function in the first place.
Better use the low-level function as shown above, or if you want to avoid having to write more code than absolutely necessary, then call the command (pseudo-)interactively:
(call-process "git" ...)or similar instead of trying to do it using Magit's API?