It is very possible, and likely, that you will get to keep your car or truck if you file bankruptcy, if you want to keep it.
If you owe on the car or truck, and you are current on your payments, then you can generally continue to keep paying who you owe and keep the car or truck in whatever type of bankruptcy you file.
If you are behind on the payments on the car or truck, and you want to keep it, there is a type of bankruptcy (Chapter 13) where you can pay for the car or truck through the bankruptcy and eliminate the payment, and sometimes lower the interest rate on the debt. You can still do this even if you are current, possibly in order to lower the interest rate.
Likewise, if you owe on a car or truck and want to stop paying and don’t want to keep the car or truck, you can surrender it and in some types of bankruptcy owe nothing, and in another type, surrender and pay what’s left owing through the bankruptcy (Chapter 13) after the car or truck is sold.
It is important that you discuss your options with an experienced bankruptcy lawyer as soon as possible. Most lawyers are willing to offer you a free, no obligation appointment to discuss your situation to see if bankruptcy is right for you and how it would effect your car or truck.