If you encounter an unwanted snake in a building or yard, there are a number of humane, nonlethal methods of removing them.
There are several types of snake traps available. The best are one of the various styles of funnel traps. Traps work best inside buildings, but can be used outside along a wall or snake-proof fence. They should be placed length-wise, so that when a snake moves along the wall or fence it will enter the trap. Traps should be used to remove a specific snake that you know is present, not set just in case a snake might come into a house.
Like many reptiles, snakes do not do well when relocated. They have very specific home territories, and when moved outside of those territories, they will go to great lengths to get back; often times they are forced to cross busy roads and may get hit by a car, or while trying to find their way back they may be spotted by a predator such as a hawk. In addition, moving animals can spread disease to areas where it does not occur. Recently, a new snake killing fungal disease has been found in Minnesota. Learn more about Snake Fungal Disease.
In light of these risks (and many more), we recommend that people do their very best to avoid moving snakes (and other animals). If people are having issues with snakes in and around their homes, we recommend "snake proofing" the home, and making minor changes to landscaping to discourage snakes from hanging around. For details about ways to accomplish this, please see the MN DNR's deterring snakes page.
Note: many parks and public wildlife areas do not allow the release of animals within their boundaries.
There is no known snake repellent. There is one commercial product which the manufacturer claims can repel one species of garter snake and one species of rattlesnake. It is made of naphthalene (moth crystals) and sulfur. Extreme caution should be used when applying repellants with naphthalene. Fumes can produce harmful effects when inhaled. Apply only according to manufactures label recommendation. It doesn't keep snakes away and can make your house and yard smelly. Homemade remedies (e.g. mothballs, pepper) also don't work.