isomorphic-git: Pushing to private GitHub repository fails
Everything works (clone, branch, add, commit)… even the onAuth
. Until I push
to my private repo.
async function push(dir: string, ref: string) {
await git.push({ fs, http, onAuth, dir, ref, force: true, remote: 'origin', remoteRef: ref });
}
const pat = () => env.GITHUB_PAT;
const owner = "Lotes";
const ref = "lotes/some/branch";
const onAuth: AuthCallback = () => {
return {
username: owner,
password: pat(),
};
};
I get the following errors:
TypeError: Cannot read properties of undefined (reading 'length')
at StreamReader.read (...\node_modules\isomorphic-git\index.cjs:2340:39)
...
ParseError: Expected "unpack ok" or "unpack [error message]" but received "".
at parseReceivePackResponse (...\node_modules\isomorphic-git\index.cjs:11616:11)
I tried out with fine-grained and classic PAT. Any ideas what is going wrong?
I am using isomorphic-git version 1.21.0
.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 26 (19 by maintainers)
I commented on the PR. Looks good to me. Thanks!
I’d be fine with showing that the username and password can be added to the URL (though I still think the onAuth/onAuthFailed callbacks should be mentioned). The point I was trying to make is that there are no more username/password options, which was a reply to Jakub. We’re in agreement that the page in the docs (which was probably overlooked as it’s a secondary page) is showing options which no longer exist. As long as the page is corrected so that it shows something that does work, I’m fine with that.
I don’t think that’s the right choice. The documentation is clearly lagging here. In isomorphic-git 1.x, the auth model was changed to be passed using the onAuth property. See https://isomorphic-git.org/docs/en/push The function no longer accepts username/password options directly. The onAuth is described here: https://isomorphic-git.org/docs/en/onAuth Let’s not roll back changes which were intentionally made.