cred_type=ds.config.obtain('{}.credential-type'.format(cfg_section), 'user_password'), ) # place in a file that contains the config name auth_file = ds.pathobj / '.datalad' / 'providers' / 'xnat-{}.cfg'.format( xnat_cfg_name) # don't stress with prev variants, all in git anyways if auth_file.exists(): auth_file.unlink() auth_file.parent.mkdir(parents=True, exist_ok=True) # write and save file to git auth_file.write_text(auth_cfg) ds.save( str(auth_file), to_git=True, message="Configure XNAT access authentication", ) # enable datalad special remote annex = AnnexRepo(ds.path) try: annex.is_special_annex_remote(DATALAD_SPECIAL_REMOTE) except RemoteNotAvailableError: annex.init_remote(DATALAD_SPECIAL_REMOTE, [ 'encryption=none', 'type=external', 'externaltype=%s' % DATALAD_SPECIAL_REMOTE, 'autoenable=true' ])