chegele / AutoGitUpdate

Update node application from git repo.
65 stars 19 forks source link

Unable to check version in private repo #4

Closed SuggeElson closed 3 years ago

SuggeElson commented 3 years ago

[9/18/2021, 2:51:07 AM] GENERAL Auto Git Update - Comparing versions... [9/18/2021, 2:51:08 AM] ERROR Auto Git Update - Error comparing local and remote versions. [9/18/2021, 2:51:08 AM] ERROR Error: This repository requires a token or does not exist.

The token is provided in config. Not sure why this fails

chegele commented 3 years ago

If you are receiving this message the page is returning a 404 response, indicating that the repo or file may not exist. Unfortunately you will see the same thing if you are not authenticated. With it being either of the two I suggest testing manually to identify which of these issues you are running into.

This is how the request is being generated. You could try using a tool like postman to manually send the request with the authentication header to see what kind of results you are receiving.

let url = config.repository + `/${config.branch}/package.json`;
if (url.includes('github')) url = url.replace('github.com', 'raw.githubusercontent.com');
if (config.token) options.headers = {Authorization: `token ${config.token}`}

For Example, a configuration file for this repository would look like this and send the following request

// The configuration 
const config = {
    repository: 'https://github.com/chegele/AutoGitUpdate',
    token: '00000000000000a', 
    ....
} 

// The url used to retrieve the remote version
https://raw.githubusercontent.com/chegele/AutoGitUpdate/master/package.json

// The header which would be used for the request
Authorization: "token 00000000000000a"

Let me know if this is any help. Feel free to reach out on Discord for quicker assistance - Chegs#6999

SuggeElson commented 3 years ago

Hello, thank you for the help. I found the error in personal token ( maybe paste it gone wrong ) I create the new one and its works. Greetings for the good script.