Restoring Solana wallet in CLI from mnemonic - solana

I am looking to restore my Solana CLI wallet from the mnemonic. The ID.json file was overwritten so I only have the seed phrase. It doesnt provide the same address when imported into phantom or sollet. Is there a command to do this or how can I restore my wallet?

Sure! From the How to restore a Keypair from a mnemonic phrase:
solana-keygen recover
There's also TypeScript and CLI examples in the Solana cookbook

Related

go get remote: The project you were looking for could not be found or you don't have permission to view it

I am using go 1.20.1 , Windows 10 x64, GoLand 2022.3.2 .
Go to ... , create file .netrc with content
machine gitlab.com login my_username password my_password
Set environment variable
then get dependency
go get gitlab.com/foo/bar/baa/fuu
Error
remote: The project you were looking for could not be found or you don't have permission to view it.
How to fix it?
First, make sure to use a PAT (Personal Access Token), not your actual GitLab account password, in %USERPROFILE%\_netrc.
Second use go get gitlab.com/foo/bar, not foo/bar/baa/fu.
As in go get gitlab.com/name_or_group/repo_name.
on Windows OS, it is not .netrc , it is _netrc (underscore character) , and not use password, use GitLab access token.

How to update a GitHub access token via command line

I use the git integration with VSCode and got the notification today that I need to renew my access token. I did so and have my new token (which I obtained through the web interface). Now I need to set my local git configuration to use the new token instead of the old one which will expire in a few days.
The VSCode docs suggest the following:
To execute the 'GitHub: Set Personal Access Token' type Ctrl+Shift+p in VSCode to open the command palette and type 'GitHub: Set Personal Access Token'. You will then be prompted to enter the token generated from GitHub.
This option isn't available in my git integration in VS code (maybe I need an update?)
How can I do this from the command line?
If you want to update Github Personal Access Token in VSCode, you need to install Github Extension
You can also update Github Personal Access Token via command line
Open a command line and set the current directory to your project root
Run the command to set remote access via a token
git remote set-url origin https://username:token#github.com/username/repository.git
Example:
git remote set-url origin https://exampleuser:b8c28127***63gu56b2d#github.com/exampleuser/exampleproject.git
Not sure if you are running on windows, but modern git binaries are using windows credential manager to store the GitHub / Git authentication details. To modify them, go to the windows "credential manager". The procedure is detailed here: https://www.sqlservercentral.com/blogs/changing-git-credentials-in-windows

Couldn't find github in keychain MacOS

August 13th, github no longer accepts password for git actions. So, to update the token, I would have to change the password field in the keychain (github keychain) to token as recommend.
But, Unfortunately I couldn't find my keychain related to github.
Where can I find the keychain for github, and edit it so that git actions works ?!
Have you tried to put your token as password for git action? When git asked for the password, just put your token as password.
If you have never logged in to GitHub yet, then you will not find GitHub in the keychain. Make sure when you generate token you checked all the scopes you need.
Assuming git config credential.helper does return osxkeychain, not finding github.com in it means: the helper is ready to cache your new credentials.
A new git push should display a prompt where you would enter your GitHub user account name, and your PAT (Personal Access Token).
Check first nothing was cached with:
printf "protocol=https\nhost=github.com"| git-credential-osxkeychain get
If it was, you could remmove it with the erase command:
printf "protocol=https\nhost=github.com"| git-credential-osxkeychain erase
I had the same problem and i solved that by connecting my github account via fork.
it will help you to solve this problem.
Just open KeyChain Access, then create a new entry >Passwords> click on the notepad symbol on the top right> in the keychain item name enter the url > then enter the username of the repo > copy the token into the password section.
First, you need to generate your PAT on GitHub.
Then go back to your terminal: run a git command, input your GitHub username and use your token in place of your password.
You can download github desktop - https://desktop.github.com/
You can signin with your github credentials and you can clone and push/pull your code.

Use go get to require dependency from private github repo on WSL 2

I'm trying out WSL 2 on windows 10 and it's gone well so far, but I've been struggling for 2 weeks to make this work, because for some reason go get doesn't use or is not able to make the Git Credentials Manager to prompt for my credentials.
I followed this blog to set up WSL2 with GCM https://www.edwardthomson.com/blog/git_credential_manager_with_windows_subsystem_for_linux.html
And it works very good for most of the daily tasks like cloning, read and write. But when using go get I get this error.
go get <remote github repo>#<latest commit id>
go: <remote github repo> 681dceefc81203e094872401c184d038090d6049 => v0.0.17-0.20200501212733-681dceefc812
go get: <remote github repo>#v0.0.17-0.20200501212733-681dceefc812/go.mod: verifying module: <remote github repo>#v0.0.17-0.20200501212733-681dceefc812/go.mod: reading https://sum.golang.org/lookup/<remote github repo>#v0.0.17-0.20200501212733-681dceefc812: 410 Gone
server response:
not found: <remote github repo>#v0.0.17-0.20200501212733-681dceefc812: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath/pkg/mod/cache/vcs/232ff028cb2fdebd254e30bfc612843483f0fe3fbeb18d5fc8fb4b20f21c9021: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Already tried ssh-keys and the solutions proposed here go get results in 'terminal prompts disabled' error for github private repo
But the error remains the same, when enabling env GIT_TERMINAL_PROMPT=1 nothing happens, I guess it's because WSL 2 doesn't have the permissions to do that. Anyway I also tried this tool https://github.com/microsoft/Git-Credential-Manager-for-Mac-and-Linux and by setting a variable for plain credentials store, it prompts in the terminal for credentials. But I'm using 2FA because it's required by the organization and the prompt only asks for username and password, so the authentication fails.
So I have to reach out to a mate who is using Mac. He is able to go get the dependency to affect go.mod, make a commit and push the change so I can pull it and continue from there. But of course this is not ideal, and he doesn't have any problem, he uses osxkeychain to manage his git credentials.
Anyone has faced this issue? or know how to solve it? Thank you so much in advance.
Go is not able to understand that certain modules are private and their checksum should not be validated against go's checksum library. The following error comes from that
verifying module: <remote github repo>#v0.0.17-0.20200501212733-681dceefc812/go.mod: reading https://sum.golang.org/lookup/<remote github repo>#v0.0.17-0.20200501212733-681dceefc812: 410 Gone
If possible use at least go 1.13 or, higher. Go had introduced an env variables by name GOPRIVATE, GONOPROXY and GONOSUMDB for managing private modules better. Simplest way to signal to Go that you are importing a private repo is to use GOPRIVATE. Set the pattern of private repos to GOPRIVATE env variable to suppress checksum validation and usage of GOPROXY. Example below avoids checksum for all repos in that hierarchy:
GOPRIVATE=github.com/<your org>/*
Check out answers here and here. You can also do go help module-private for help.

How do you reset the stored credentials in 'git credential-osxkeychain'?

I've followed the GitHub instructions for setting up my account, and I'm able to clone, but I'm unable to push remotely.
When I do a "git push" I get the 403 error. It has the correct URL. I tried a "git credential-osxkeychain get" to see what it was giving, and this prints out the wrong credentials.
I believe what happened is the first time it asked for the credentials, I thought it was another application asking, and it put the wrong ones in.
I just need to reset it so that it uses the correct keychain item for my GitHub account.
I've tried:
git credential-osxkeychain erase
git credential-osxkeychain set
The program never gives any prompts. Set will say "bad input" if I don't do the right thing. I tried putting in "password=password", etc., but then when I do a "get" I still get the old ones.
I can't figure out where these are being stored, as they are not in .gitconfigure. Further there are no recent keychain items that could be it. (I have several GitHub accounts in my keychain and it is not using any of them.)
From Terminal:
(You need to enter the following three lines)
$ git credential-osxkeychain erase ⏎
host=github.com ⏎
protocol=https ⏎
⏎
⏎
NOTE: after you enter “protocol=https” above you need to press ~~RETURN~~ TWICE (Each '⏎' is equivalent to a 'press enter/return' )
I'm not sure how to erase through the command line, but it's fairly easily to do it through the Keychain Access app. Just go to Applications -> Utilties -> Keychain Access, then enter "github.com". You can either delete the invalid item or update the password from with the app.
The solution turned out to be this:
The command git credential-osxkeychain was using the first GitHub account entry in my keychain. This one was not the one that had access to the projects in question.
I resolved the problem by touching the account in Keychain Access so that its date changed (I think I just changed the comment) and now that it became the most recent GitHub account it became the first one returned to credential-osxkeychain, and thus everything worked.
A better form of support for multiple GitHub accounts would be nice, but it is likely that most people only have one primary account and don't run into this problem.
Try this in your command line.
git config --local credential.helper ""
It works for me every time when I have multiple GitHub accounts in OSX keychain
On Mac, use the command git credential-osxkeychain erase.
OR remove manually from keychain from Applications → Utilities → Keychain Access. Then remove the github.com keychain. Then use push; it will ask for the keychain access; then deny.
It will ask for the new username and password, add it then pushes a file for that.
After git push I found this error. Then I use the upper case-
issue:
remote: Permission to user1/file.git denied to user2(previously exist
user ). fatal: unable to access 'https://github.com/xxxxxxxxxxxx/':
The requested URL returned error: 403
git-credential-osxkeychain stores passwords in the Apple Keychain, as noted above.
By default, gitcredentials only considers the domain name. If you want Git to consider the full path (e.g. if you have multiple GitHub accounts), set the useHttpPath variable to true, as described at http://git-scm.com/docs/gitcredentials.html. Note that changing this setting will ask your credentials again for each URL.
You can delete existing credentials and add new ones via "Keychain Access"
Ref. https://docs.github.com/en/github/getting-started-with-github/updating-credentials-from-the-macos-keychain
GitHub help page for this issue:
https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
Try running /Applications/Utilities/Keychain Access.

Resources