0

In my python program, I am trying to dynamically set user credentials - GIT config for GIT.

Repo.config_writer().set_value("user", "name", "username").release() Repo.config_writer().set_value("user", "email", "email@domain.com").release()

It is giving error, TypeError: config_writer() missing 1 required positional argument: 'self'

git.Git(path).clone(gitlab_url) - Clone is working perfectly.

torek
  • 448,244
  • 59
  • 642
  • 775

1 Answers1

0

Not sure if the name of the variables count so much, but you could try (taking into consideration that you've put you data in variables, not directly into the set_value() method):

repo.config_writer().set_value("user", "name", "myusername").release()
repo.config_writer().set_value("user", "email", "myemail").release()

If this one doesn't work, a workaround could be :

os.system("git config --global user.name \"firstname lastname\"")
os.system("git config --global user.email \"youremail@email.com\"")

Hope this helps!

  • I got following error on trying repo.config_writer -> AttributeError: module 'git.repo' has no attribute 'config_writer – Kamal Baldawa May 26 '22 at 21:17