Ruby on rails : problem of verifiying the SSL certificate while installing bundle

I’m new with ruby on rails and while creating my first project with this command rails new n_project, i got this error

run bundle installFetching source index from https://rubygems.org/ Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see ...

Source: Ruby on rails : problem of verifiying the SSL certificate while installing bundle

I develop software using a pretty varied mix of technologies, including C#, VB, Postgres, SQL Server, and Azure services of all kinds, but mostly Ruby on Rails. After 15 years of using it, I find that it remains one of the most force-multiplying tech stacks in the world. With it, by myself, I can develop software faster than entire teams of outsourced, waterfall-managed, Java/React projects. (And I proven that multiple times.) Not only that, but the future is looking even brighter with Rails 7.

Anyway, I develop software on my personal MacBook Pro, upload it to a git host, and deploy it to a Linux VM on Azure. But my work-supplied laptop is, of course, a bog-standard, boring Dell running Windows. I feel an obligation to be able to use it to do everything I would normally do on my Mac, just in case the hammer falls, and they outlaw the way I work. So, on Windows, I use RubyInstaller. But, thanks to my company’s bog-standard industry practices of using Cisco products to lock down the laptop within an inch of usability, I’ve been unable to do a bundle update for awhile now, getting the error listed above.

I had previously worked around this situation by using CNTLM to tunnel command-line-based HTTP/S requests through my company’s firewall. This was no longer working.

I tried changing my Gemfile to use HTTP, instead of HTTPS. I tried getting gem to ignore SSL errors (and use HTTP sources). None of this worked either.

Yesterday, I had finally had enough of the problem, and decided to work through it. Helpfully, the error message included the fact that I was missing the Cisco Umbrella CA certificate in the certificate chain. Also helpfully, Cisco has a page where you can download their certificates, ciscoumbrellaroot.pem and crca2048.pem. Also helpfully, I found the linked StackOverflow Q/A. That got me started, and I finally figured out the RubyInstaller people have anticipated this problem. There’s a proper way of adding a certificate to your chain. Just drop the certs in C:\Ruby-xx-x64\ssl\certs. This allowed me to get rid of all the hacky workarounds, and now bundler works like I expect it to work on my work laptop.

Ruby on Rails on Windows is not just possible, it’s fabulous using WSL2 and VS Code – Scott Hanselman

I’ve been trying on and off to enjoy Ruby on Rails development on Windows for many years. I was doing Ruby on Windows as long as 13 years ago. There’s been many valiant efforts to make Rails on Windows a good experience. However, given that Windows 10 can run Linux with WSL (Windows Subsystem for Linux) and now Windows runs Linux at near-native speeds with an actual shipping Linux Kernel using WSL2, Ruby on Rails folks using Windows should do their work in WSL2.

Source: Ruby on Rails on Windows is not just possible, it’s fabulous using WSL2 and VS Code – Scott Hanselman

I’ve been doing Rails for about 13 years as well, and I’ve been following Scott for probably about that long. Heck, being a tech evangelist for Microsoft, it was probably him that alerted me to the fact that WSL was being put into Windows to begin with. And using it for Ruby on Rails development is precisely why I wanted it. So when it was first released in Windows 10 Insiders Edition, I hastily upgraded my gaming rig to try it out.

There were literal, show-stopping bugs that prevented doing the “normal”  kind of Rails development, where you install a Ruby version manager, then install the bundle gem, then install Rails, then bootstrap your site.

I keep wanting to say “emerge” when I mean “install.” I guess using Gentoo broke my brain, but, really, that’s what’s going on. When you’re doing this sort of thing, you’re installing software that’s dependent on your environment, which is exactly why portage was created.

I filed some bugs, and watched and waited. A couple of them were fixed pretty quickly. But then other problems became apparent, and they weren’t going to be fixed any time soon, so I gave up.

Then they announced the release of a big upgrade to the system. So I tried again. And, again, I found problems that prevented me from being able to develop with Rails. So I gave up, and stopped watching this space.

Now Microsoft has been evangelizing a total rewrite of WSL, and how they’ve made it “native,” and how this fixes compatibility problems and speed issues. But all they’ve done is make the tool a total virtualization of the environment, when the whole point of WSL was that it was not a virtualized environment!

WSL was supposed to bring “open source” development (like Rails, and Node) out of the dark ages on Windows, and make it a first-class workflow on the platform. This was easy to believe, because Microsoft was really lagging in these popular development scenarios, and it could be expected that they were motivated to create a bridge to get back on equal footing with Mac as the platform of choice for working with modern web technologies.

However, the situation on Windows is now worse than ever. It used to be such a hassle to do this kind of work on Windows that you’d install VirtualBox, create a VM, map your VM’s drive onto a Windows mount point, and run your development tools on the files in the mounted drive. Now, WSL2 is basically doing that for you, and not even giving you the courtesy of a GUI to manage the virtualization settings. I guess the positive way of looking it is that they’ve created a VirtualBox-type Linux VM with all the file-system mapping pre-configured.

It’s telling that the workflow that Scott is proposing is to use Visual Studio Code with a plugin for remote development.

Whatever. It’s a hard pass for me, dawg. If I needed this, I’d just install VirtualBox, and be explicit about what I’m doing.

As a side note, I’ve been using RubyInstaller for years now, on my work laptop, and it “just works.” I mean, sure, you’re limited to a specific version of Ruby, but I just make that my base, and “emerge” that one on my Mac and the Linux host server, and everything lines up. So my need for any sort of virtualized Linux environment on Windows has already been satisfied.