I am trying to copy .git folder of private repo of any user when access token is provided using python. However, I could not be able to download it. I found bash script to download the file but I wanted to retrieve only .git folders. This is what I was trying
python script
TOKEN = "tokensoicanaccessprivaterepo"
OWNER=""
REPO=""
API_URL=f"https://api.github.com/repos/{OWNER}/{REPO}?access_token={TOKEN}"
req_json = requests.get(API_URL).json()
# git_url = req_json['ssh_url']
# git clone https://${TOKEN}:x-oauth-basic@github.com/{OWNER}/{REPO}.git
os.system(f"git clone https://${TOKEN}@github.com/{OWNER}/{REPO}.git")
the way I am doing asks for password event after providing personal access token with repo and user scope while cloning.
I have looked into various resources but I did not find the way to copy '.git' folder of private repo of any user with the github provider token.
UPDATE
scope