How to set solana config's keypair value

Context
The default keypair location is ‘~/.config/solana/devnet.json’. (seen by command: ‘solana config get’)

Whenever I run the recommended command “solana-keygen new -o ~/.config/solana/devnet.json” on my windows machine it creates the subdirectories starting with ‘~’, not recognizing that ‘~’ in linux is a %userprofile% shortcut that points to the users home directory.

My Issue
When I change my directory I lose the pointer to my key pair. So for example when I change my directory and run ‘solana balance’ I get the response:

“solana-keygen new -o ~/.config/solana/devnet.json”

My solution
Use solana config’s subcommand ‘set’ but the --help flag and solana documentation had nothing to offer in terms of actual usage other than that it exists and you can set a config value.

BUT HOW???

The Commands Below are:

  • solana config help (executed)

  • solana config get (executed)

  • solana config set (not executed)

Hi @Mush and welcome to the forum! :wave:

Thanks for a good explanation for your problem. :slight_smile:

If you run solana config set --help it will show you that you can set the keypair path like this:

solana config set --keypair C:\path\to\keypair.json

That should fix your issue. Let me know if you have any more trouble!

1 Like