I've gone through various Q/A(s) of the problem of ganache-cli and metamask not linking but after trying all the solutions, still doesn't work for me. As soon as I type ganache-cli in windows cmd prompt and many private keys are displayed with fake accounts. My port where ganache is activated is 8545, so I've made changes in truffle-config.js file as well, otherwise the <code>truffle test</code> and <code>truffle migrate</code> wasn't successful.

My truffle-config.js file-

  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "",
      port: 8545,
      network_id: "*" // Match any network id
    develop: {
      port: 8545

Using metamask I/ve tried various combinations of TestRPC URL, but none of them work. Also, I've tried connecting localhost:8545 given in list, still doesn't work.

All urls fail

I'm tryng triffle pet shop tutorial, When the GUI opens in browser and I click on adopt, nothing happens.

  • Those are not "fake accounts". They are totally real (within the private network that you run on you machine using Ganache). Oct 21, 2019 at 8:19
  • Okay, the tutorial I was following said 10 fake accounts are created. Cool, thanks for correction. I'll keep that in mind.
    – minsuga
    Oct 21, 2019 at 8:26

2 Answers 2

  1. First, switch network to another network and try to reconnect again to ganache network(

  2. Make sure While you connecting to matamask using ganache, you have set up a connection like below :

enter image description here

  1. Then you need to import accounts in metamask using private keys provided in ganache. You can see I already imported account that is shown as Account3 with 100ETH in the below image.

enter image description here

That's it. it works fine. Hope it will help you.

  • Thanks Mahesh, but even after trying it, it shows cannot connect. And after opening the HTML file, any input doesn't make any kind of change in the command prompt as it should be according to this tutorial [link] (trufflesuite.com/tutorials/pet-shop) . I get stuck at step 8 and 9. Still the balance shown is 0 Ether.
    – minsuga
    Oct 27, 2019 at 16:06

Click on your user picture, and then select import account from drop down in metamask. And then input the secret key (one that you get when you click the key button) from you gnache gui server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.