Monday 28 September 2020

account name in PyGithub

I am using the package PyGithub in order to try and automate the creation of a new github repo.

from github import Github

g = Github(token)
user = g.get_user()
repo = user.create_repo(name)

After creating that repo I am creating a local one too, and simply try link them.

One of the commands I need to execute is git remote add origin git@github.com:<AccountName>/<RepoName>.git

I don't want to hard-code my account name into this script so I am trying to get that name from the Github package.
Apparently, on github, I have two 'user names' - one of them is the profile name and the other one is the account name.
When I execute user.name I get my profile name and not my account name which I need.

Is there anyway to get that account name specifically?



from account name in PyGithub

No comments:

Post a Comment