Alameda County sheriff's deputies shot and killed a man they mistakenly thought was walking toward them with a gun early Monday morning near San Leandro, according to authorities.