Remote: Support for password authentication was removed on August 13, 2021

I like Travis-CI a lot. I had been using it successfully for some time but today when I ran a build I got this error:

remote: Support for password authentication was removed on August 13, 2021

The last build I ran was in 2022 (after August 13, 2021) and that did not complain.

I am not using password for authentication. I am using a token like this:

t.remote_url = -> {
        url = `git config remote.origin.url`.strip.gsub(/^git:/, 'https:')
        next url.gsub(%r{^https://}, "https://#{ENV['GH_TOKEN']}@") if ENV.key? 'GH_TOKEN'
        next url
    }

can anyone help me fix this? why was it working before and not now?

First, check if your GitHub token (GH_TOKEN) has expired or been revoked, and if necessary, regenerate a new token from your GitHub settings. Next, verify that the GH_TOKEN environment variable is correctly set in your Travis CI settings, which you can review in your repository settings on Travis CI. Additionally, ensure that the token has the necessary permissions, specifically the repo scope if you’re accessing private repositories.

Finally, double-check that there haven’t been any recent changes to the script or repository configuration that could affect how the token is used.