Repainting a crib ?

Elizabeth
Does anyone have experience or advice on repainting a crib? A friend is basically giving us a brand new one bc they continued to co sleep and never used it. Is it safe to paint it to match the nursery? Thanks in advance !