Seeing 401 unauthorized errors when trying to clone private repo
See original GitHub issueHi! Firstly thanks for creating this library 😃
I’m new to this and unsure if I’m doing something wrong here, but I’m constantly seeing 401 errors when trying to clone a private repo of mine.
Here’s what I’m trying (in Chrome 83 on OSX 10.15):
<script src="https://unpkg.com/@isomorphic-git/lightning-fs"></script>
<script src="https://unpkg.com/isomorphic-git"></script>
<script type="module">
import http from 'https://unpkg.com/isomorphic-git@beta/http/web/index.js'
window.http = http;
</script>
let fs = new LightningFS('fs');
let pfs = fs.promises;
let dir = "/data";
await pfs.mkdir(dir);
await pfs.readdir(dir);
await git.clone(
{
fs: fs,
http: window.http,
dir: dir,
corsProxy: 'https://cors.isomorphic-git.org',
url: 'https://github.com/pickledish/private-repo',
ref: 'master',
username: 'pickledish',
password: "valid-personal-access-token-123",
singleBranch: true,
depth: 10,
}
);
But seeing this error:
GET https://cors.isomorphic-git.org/github.com/pickledish/private-repo/info/refs?service=git-upload-pack 401
I’ve verified that I’m able to pull public repos this exact way ^ without issue, and also verified via git clone https://github.com/pickledish/private-repo
(in bash) that this particular username/token combo works, so I’m not sure where to go from here. If the answer is just to read some documentation, happy to read it, but haven’t been able to find anything about this in my searches.
Thanks in advance, lmk if I can add any more detail!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
git clone over https 401 error and not asking for username or ...
When I try to clone it on an Ubuntu server, it never asks me for a username or password and it fails with...
Read more >Git clone in a job returns 401 unauthorized error - GitLab
When running git clone <repo> in a job via gitlab-runner, get 401 Unauthorized error: error: The requested URL returned error: 401 while ...
Read more >HTTP 401 Unauthorized Error | What Is and How to Fix?
401 Unauthorized Error is an HTTP response status code indicating the request sent by the user couldn't be authenticated.
Read more >401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error indicates that the server's request was not verified because it lacks valid authentication credentials for the target ...
Read more >"401 Unauthorized" error when cloning TFS git repository - Bugs
I received the following error when I tried to clone TFS git repository: <tfs_url>: 401 Unauthorized I did not find any other log...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am able to this using the following url
https://pickledish:valid-personal-access-token-123@github.com/pickledish/private-repo
and removing the
username
andpassword
fields like thisNot sure if it’s the best way to do it, but it should be ok.
That’s correct. This is clearly documented in the documentation. See https://isomorphic-git.org/docs/en/onAuth. This was a change that came with isomorphic-git 1.x. Unless there is a specific question about those docs, I don’t think this issue should remain open.