code: def test_gitcredential_interface(path=None):
      # use a dataset as a local configuration vehicle
      ds = Dataset(path).create()
  
      # preserve credentials between git processes for a brief time
      # credential-cache is not supported on windows (needs UNIX sockets)
      # ds.config.set('credential.helper', 'cache', scope='local')
      # However, first set an empty helper in order to disable already set helpers
      ds.config.set("credential.helper", "", scope="local")
      ds.config.set("credential.helper", "store", scope="local")
  
      # git manages credentials by target URL
      credurl = "https://example.datalad.org/somepath"
      credurl_justhost = "https://example.datalad.org"
      # define a credential
      cred = GitCredentialInterface(
          url=credurl, username="mike", password="s3cr3t", repo=ds
      )
      # put it in the manager (a cache in this case, but could invoke any number
      # of helpers
      cred.approve()
      # new instance, no knowledge of login
      cred = GitCredentialInterface(url=credurl, repo=ds)
      assert_not_in("username", cred)
      # query store
      cred.fill()
      eq_(cred["username"], "mike")
      eq_(cred["password"], "s3cr3t")
      # git does host-only identification by default (see credential.useHttpPath)
      cred = GitCredentialInterface(url=credurl_justhost, repo=ds)
      cred.fill()
      eq_(cred["username"], "mike")
      eq_(cred["password"], "s3cr3t")
  
      # the URL is enough to remove ("reject") a credential
      GitCredentialInterface(url=credurl, repo=ds).reject()
  
      cred = GitCredentialInterface(url=credurl, repo=ds)
      # this will yield empty passwords, not the most precise test
      # whether it actually removed the credentials, but some test
      # at least
      cred.fill()
      assert_false(cred["username"])
      assert_false(cred["password"])
  
imports: from datalad.api import Dataset
  from datalad.downloaders.credentials import UserPassword
  from datalad.local.gitcredential import GitCredentialInterface
  from datalad.tests.utils_pytest import assert_false, assert_is_instance, assert_not_in, assert_true, eq_, with_tempfile
  from datalad.utils import Path, chpwd
label_desc: Use image node_id 1 for calling a global function with example usage: test_gitcredential_interface(path) without return types