How do you pass a PAT in a .from_source()? flow.f...
# pacc-aug-28-29-2024
c
How do you pass a PAT in a .from_source()? flow.from_source( source="https://github.com/Chris-Allsberry/prefect-test-00.git", entrypoint="pause_flow_01.py:greet_user", # How do I pass my PAT? ).deploy( name="github pull test 2", work_pool_name="Chris_Work_Pool_01" )
b
Hey Chris! I think you could do something like this:
Copy code
from prefect import flow
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials


if __name__ == "__main__":
    flow.from_source(
        source=GitRepository(
        url="<https://github.com/org/private-repo.git>",
        credentials=GitHubCredentials.load("my-github-credentials-block")
    ),
    entrypoint="my_file.py:my_flow",
    ).deploy(
        name="private-github-deploy",
        work_pool_name="my_pool",
        build=False
    )
🙌 1
the access token is in the GitHub Credentials block
The example was from here in case you want to take a look
c
I had to install the prefect-github. When I did that it also seemed to upgrade my prefect to 2.20. now I'm getting this error when I try to start the server: | _ \ _ \ __| __| __/ _| _| | _/ / _|| _|| | (_ | | |_| |_|_\___|_| |___\___| |_| Configure Prefect to communicate with the server with: prefect config set PREFECT_API_URL=http://127.0.0.1:4200/api View the API reference documentation at http://127.0.0.1:4200/docs Check out the dashboard at http://127.0.0.1:4200 153708.204 | ERROR | root - An error occurred: [WinError 5] Access is denied Server stopped!
I wiped out my whole venv and reinstalled prefect and version 2.20.3 still gives me the ERROR | root - An error occurred: [WinError 5] Access is denied
Looks like there is thread and upcoming fix for this: https://prefect-community.slack.com/archives/C048ZHT5U3U/p1724690189280139
So with this bug in the latest release, what operating system do you think we should be using? Linux?
b
Linux is a popular choice, but after the fix is released, you should be able to continue using windows without that issue!