Legacy Auto-Update, Needs Attention - composer-php

When I log into packagist.org I get this message on my packages:
This package is using the legacy GitHub service and will stop being auto-updated in early 2019. Please set up the new GitHub Hook for Packagist so that it keeps working in the future.
When I visit https://packagist.org/about#how-to-update-packages the instructions seem to be more talking about how to set it up from scratch then anything.
I'm already logged in and my GitHub account is already linked (do I need to unlink it and relink it?)
When I click on https://github.com/settings/connections/applications/a059f127e1c09c04aa5a I see the "Access public information (read-only)" has a green checkbox next to it.
When I check https://packagist.org/profile/ it doesn't say that they're not automatically sync'd. What it does say is "Legacy Auto-Update, Needs Attention".
The URL suggests you trigger a manual account sync "to have Packagist try to set up hooks on your account again". I'm assuming the way you make Packagist do a manual sync is by clicking the "Update" button. I tried that to no avail.
Any ideas?

You should take a look at this issue: https://github.com/composer/packagist/issues/907 - GitHub deprecated GitHub Services, which was previously used for integration with Packagist. Packagist should switch to GitHub app when you first login to Packagist using GitHub OAuth.
If you already have connected GitHub account to Packagist account, try to logout and login using GitHub - you will be asked about permissions, which allows to automatically setup webhooks for repositories. After this everything should update automatically.
In other case you can connect GitHub account to existing Packagist account on settings page.

Related

Force password entry before each GitHub push in VS Code on macOS

How can I force VS Code to ask for my macOS Keychain password before each push to GitHub?
VS Code never asked for my GitHub password (via Keychain) until I pushed to GitHub and it asked before each push again.
This was working until a few hours ago when I had some issues and revoked my access and VS Code requested a new token.
Now VS Code does not ask at all for a password. Even when I remove VS Code from the Keychain whitelist, it asks for my password at program start only once and then not again, even not for pushes.
I want VS Code to request my GitHub token before each push from Keychain again.
After comparing my current macOS login Keychain with one from a Backup where everything was still working as I wanted, I found a solution:
There seem to be at least two ways of how VS Code accesses the Keychain:
Directly via OAuth. This is used when VS Code automatically requests an access token via the GitHub website. It stores the token in the Keychain with the name vscodevscode.github-authentication.
Indirectly via git-credential-osxkeychain and a personal access token that is stored in the Keychain with the name github.com.
VS Code seems to decide automatically which way it uses depending on which keys it finds in the macOS Keychain.
I have not found a way how to force VS Code to ask for the Keychain password on each push when using OAuth, but it is working via git-credential-osxkeychain now.
Solution
Request a personal access token via GitHub / Settings / Developer settings / Personal access tokens
Retreive your GitHub ID via: https://api.github.com/users/<your user name>
Open Keychain Access and create a new password item:
Keychain Item Name: https://github.com
Account Name: <your GitHub ID>
Password: <your personal access token>
Notes:
If VS Code asks for your Keychain password multiple times, try a push via command line
click on Always Allow on the request that asks to ...access key "github.com"...
click on Allow on the request that asks to ...use your confidential information stored in "github.com".
This is a complete "try and error" solution, I have not found much information about that. It would be great if someone could explain what is actually going on here. I have also not found any official information about setting up VS Code via git-credential-osxkeychain.
I guess git needs to be installed to make that work. I installed it via Homebrew
At least for me this solution works for pushing via VS Code GUI, VS Code integrated terminal and OS terminal.
Check your git config --global credential.helper: it references the program in charge of caching your credentials.
A git config --global --unset credential.helper would remove it, forcing Git to always ask for your credentials.

"Failed to load owners" error in Xcode using GitHub

I am just starting out trying to connect Xcode to Github. I keep getting this peculiar error, saying "Failed to load owners" whenever I try to create a remote repository from within Xcode under the Source Control Manager. See the error here
If I ignore the warning, the upload then fails with this error.
I cannot seem to find anything online regarding this, and I cannot for the world notice anything being wrong with my GitHub account. The account itself is also accepted by Xcode (successfully added under the Accounts pane in Preferences).
Any help will be greatly appreciated.
In your GitHub account, when you are creating a personal access token to connect your Xcode to GitHub, you have to check off repo, write:packages, and read:packages.
Shown by the image here: https://i.stack.imgur.com/NUiiC.png
Then, you should be able to create the repo without any problems! Hope this helped.
I deleted my GitHub-Profile in the XCode Preferences and setted up again. After that it worked smoothly.
After having had a chat with a kind representative from GitHub Developer Support, it seems like it in my case had to do with my old username and password credentials that was saved on my machine. I quote:
Sometimes applications can use these old credentials, even if you
replace it with the personal access token.
Credentials for git authentication are stored in the Keychain App, and
git passes these onto GitHub when pushing changes to a Repository.
I'd suggest checking in the Keychain App for any records with the name
GitHub.
If they exist, delete those and try the push again.
Git should ask you to enter your username and password and once you
re-enter them, the correct credentials should be stored in your
Keychain app for future use.
So there you have it. This in fact solved my problem. It could also have had something to do with the personal access token that might not be set up with the proper permissions. If you have the same problem as I had you could also check out the scopes on your personal access token to verify it has access to everything you need. Step 7 on the help guide below has a screenshot of what that looks like:
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
For anyone who's looking for another way. What happened to me is that my personal access token expired, and I needed to generate a new one in Github / setting/ developer/ access token. After I generated a new one, I logged out of Github via Xcode, Logged back in and put in my new access code and cleared the issue!

How do I get my GitLab project to auto-update on Packagist.org?

I have posted my libre software GitLab project on Packagist, and this succeeded but Packagist indicates next to its name that it "Does not auto-update". It does not say how to make it so it automatically updates.
GitLab added official integration with Packagist so you just need to go to Integrations and enable it (or go directly to gitlab.com/[your-org]/[your-project]/services/packagist/edit) and enter your username and API token from your Packagist profile and everything is all set.

Personal Access Token in Github not working

I have a private repository on my personal Github account that I work on from time to time, but not on a daily basis.
The repository has been cloned using HTTPS (not SSH or git://).
In order to access the repository from the command line, I set up a personal access token as explained here: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
I am positive it did work back then (I moved away from SSH precisely because this kind of persistent headache).
However, when I try to push to my repository after a few weeks I get the dreaded:
$ remote: Repository not found. fatal: repository
$ 'https://github.com/nicolas-miari/MyPrivateRepo.git/' not found
What am I missing?
Addendum: I deleted the token on Github, created a new one, and followed the instructions here: https://help.github.com/articles/updating-credentials-from-the-osx-keychain/ to clear the old token stored in the keychain. I was able to re-clone my private repository. However,
This still doesn't explain why the previous access token suddenly stopped working, and
My keychain had two "Internet password" entries matching the host github.com: The access token I just deleted, and the my web login password for a different Github account (work). Maybe this has something to do with it?
Background info: To avoid having to log in/out frequently, I have my work account's web credentials saved in Safari (and the Keychain), and my personal account's web credentials saved in Firefox.
Addendum 2: After running the command given on the linked help page:
$ git credential-osxkeychain erase
host=github.com
protocol=https
[enter]
...the additional password is gone from the Keychain (only my newly added Personal Token remains), however I can still log in to my account on Safari...?
Update: Now I can't push to repos from my work account (which credentials I deleted from Keychain...). This system really needs a healthy dose of Just Works...
I have a private repository that I have a dependency on, using https://github.com... in my package.json. I have ssh set up on my computer, also I have personal access token. Even though I provide my personal access token as the password it fails. So I changed my git config url using the following and it worked like a charm.
git config --global url."git#github.com:".insteadOf "https://github.com/"
You can double check your ~/.gitconfig to see something like this:
[url "git#github.com:"]
insteadOf = https://github.com/
I tried all the suggestions I could find and the only thing that worked for me was deleting Git on my computer. Once I downloading it again it asked me to to login with browser, which I did and then it worked
Don't forget that Safari has access to iCloud Keychain
That could explain why, even though you have cleared your local OSX keychain, you still can log on to GitHub with Safari.
My colleague was facing the same issue on Linux, and we just logged out from the browser and logged back in, and git commands from the terminal started working with PAT, don't know the relation of terminal command with browser authentication but it worked.
Best guess is that the token expired.
At the time of writing, you can set the token expiration period. If you attempt to select "No expiration", the GitHub UI gives the explicit warning:
GitHub strongly recommends that you set an expiration date for your token to help keep your information secure.
When you inspect existing Personal Access Tokens, you can see an indication of when it was last used and when it's due to expire.
Not sure about when this question was asked 5 years ago but, I assume, as this type of auth was optional back in the day the UI was probably less helpful. The OP mentioned using the repo occasionally and if you set up a token for the first time with expiry of 30 or 60 days, it's easy to have forgotten that a couple of months later.

Laravel 5.1 Socialite 2.0 issue with Bitbucket driver - Required Repository?

I'm creating an application in Laravel 5.0 and I want implement socialite 2.0 as OAuth package.
I tried this package for GitHub, Google, Linked In and everything is working fine. But after configuring my Bitbucket account and granting permission to read Email scope, I'm receiving this error:
Received error [{"error": {"message": "Your credentials lack one or more required privilege scopes.", "detail": {"granted": ["account"], "required": ["repository"]}}}] with status code [403] when retrieving token credentials.
After editing my consumer account in Bitbucket and adding Read Repository Permission, everything going to be fine except receiving Null Emails.
First, I don't want to prompt my users to allow to access their repositories, I don't need them and I don't want to scare my clients.
Second, how can I solve null email issue?
I feel your pain. User authentication via third-party without the user email is, to say the least, useless. In the very extreme, it might be dangerous and unsafe to ask for the user to input an email.
Thus, I've created a small fork of the original Bitbucket connector (from the League Of Extraordinary Packages): https://github.com/igorsantos07/oauth1-client
The best way to retrieve the user email and other missing info (such as location) was upgrading to API 2.0, what means repositories are not retrieved anymore. It might be a breaking change for some users, but I guess for many others it will actually be less data to be downloaded.
To install that fork into your project, add/merge the following to your composer.json:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/igorsantos07/oauth1-client"
}
]
Then, you should composer require league/oauth1-client:dev-master. It will download the fork's master branch, with the said Bitbucket upgrades.
Note: I still have nooooo idea why Bitbucket asks for repository permissions to retrieve user emails. Go figure...
In your users migration you will need to set email up as being able to add an account without there being an email.
change:
$table->string('provider')->default('myapp');
to:
$table->string('provider')->default('myapp')->nullable();

Resources