I am trying to follow the truffle pet shop tutorial. But failed to connect metamask with ganache-cli I ran ganache-cli in the console and changed the rpc url to But the addresses are still not loading and neither the balance is going up.

3 Answers 3


In order to connect metamask to ganache-cli you need:

  1. run ganache-cli (if you run it with parameters, pls provide them, would be better provide execution command)
  2. choose "Localhost 8545" in list of Networks in metamask
  • I tried its not working Sep 29, 2018 at 16:13
  • have you connected metamask to "Localhost 8545" or you see loader in metamask?
    – Aquila
    Sep 29, 2018 at 16:23
  • If metamask connected successfully, but you can’t see accounts, it is normal, you need to import accounts from ganache-cli manually.
    – Aquila
    Sep 29, 2018 at 17:03
  • How do I do that? Sep 29, 2018 at 20:44
  • 2
    You need to copy private key in ganache-cli, then open metamask -> click on account -> click on "Import Account" -> put private key into field -> click Import -> switch account (if needed). Imported account should have 100Eth. Do not forget to select network "Localhost 8545"
    – Aquila
    Sep 29, 2018 at 20:54

What i did is go to custom rpc and paste ganache url i.e to new rpc url and then save it.... worked for me try it out.


This is just a miner issue I guess. Check the Port of GANACHE running in your PC. METAMASK connects with the port number 8545. And if your GANACHE is not running in that PORT, you'll face the issue. (sometimes ganache runs on 7545 instead of 8545) This issue can be solved either changing the port number in the server configuration of your GANACHE setup. OR through changing the network from localhost at 8545 to custom rpc and by adding as URL.

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.