def __enter__(self):
		matchObj = SSHEnvironment.gitSshUrlPattern.match(self.source)

		if matchObj is None:
			self.isSshUrl = False
			return None

		self.isSshUrl = True

		sshUser = matchObj.group('user')
		sshHost = matchObj.group('host')
		sshPort = matchObj.group('port')
		sshRepositoryPath = matchObj.group('repositoryPath')
		if sshPort is None:
			sshPort = '22'

		tmpHostName = generateRandomString(20)
		sshConf = "\n\nHost {0}\n\tHostName {1}\n\tUser {2}\n\tPort {3}\n\tStrictHostKeyChecking no\n".format(tmpHostName, sshHost, sshUser, sshPort)
		try:
			sshConf += "\tIdentityFile {0}\n".format(self.config['Git']['IdentityFile'])
		except KeyError:
			pass
		cloneSource = 'ssh://{0}/{1}'.format(tmpHostName, sshRepositoryPath)

		sshConfigDirPath = os.path.join(os.path.expanduser('~'), '.ssh')
		sshConfigFilePath = os.path.join(sshConfigDirPath, 'config')
		if not os.path.exists(sshConfigDirPath):
			try:
				os.mkdir(sshConfigDirPath, mode=0o700)
			except __HOLE__:
				# < Python 3.3 compatibility
				os.mkdir(sshConfigDirPath, 0o700)
		if not os.path.exists(sshConfigFilePath):
			with open(sshConfigFilePath, 'w'):
				pass
			os.chmod(sshConfigFilePath, 0o600)

		self.sshOrigConfigFile = TmpOrigFile(sshConfigFilePath, postfix="gitdh")
		self.sshOrigConfigFile.create()

		with open(sshConfigFilePath, 'a') as sshConfigFileObj:
			sshConfigFileObj.write(sshConf)

		return cloneSource
dataset/ETHPy150Open seoester/Git-Deployment-Handler/gitdh/modules/external.py/SSHEnvironment.__enter__