Hi SarcasticSparrow10 ,
Where is the worker configuration file located so that I can add GitHub credentials?
Trains Agent uses a trains.conf
file (usually created using trains-agent init
, see https://allegro.ai/docs/deploying_trains/trains_agent_install_configure/ ). You can use this file to set up your Git credentials (see example https://github.com/allegroai/trains-agent/blob/60eeff292d988e56542b63153effe78a8c7cf3eb/docs/trains.conf#L18 ), or you can use environment variable when running the Trains Agent ( TRAINS_GIT_USER
and TRAINS_GIT_PASS
)
Ok, So Git credentials are present at two locations - 1) outside the agent
config and 2) inside it. I updated credentials at both locations and now I'm seeing agent.git_user = <username>
in the dump, but I still have the same issue.
` # Set GIT user/pass credentials
leave blank for GIT SSH credentials
agent.git_user=<username>
agent.git_pass=<PAT>
extra_index_url: ["
"]
agent.package_manager.extra_index_url= [
]
agent {
# unique name of this worker, if None, created based on hostname:process_id
# Override with os environment: TRAINS_WORKER_ID
# worker_id: "trains-agent-machine1:gpu0"
worker_id: ""
# worker name, replaces the hostname when creating a unique name for this worker
# Override with os environment: TRAINS_WORKER_NAME
# worker_name: "trains-agent-machine1"
worker_name: ""
# Set GIT user/pass credentials (if user/pass are set, GIT protocol will be set to https)
# leave blank for GIT SSH credentials (set force_git_ssh_protocol=true to force SSH protocol)
git_user: <username>
git_pass: <PAT>
# git_host: "" `
That makes sense. The configuration file is located at ~/trains.conf
which I believe is the default location.
No I can't see my username printed out in the dump
SuccessfulKoala55 Yes, I am using the --docker flag.
You are right about the Keyring. Once I make sure credentials are stored in a secure way, it works as expected. Thanks :)
I'm using docker to run the experiment. Could it be that the config in the docker container doesn't have the git credentials?
Are you using the Agent's --docker flag?
SuccessfulKoala55
For security reasons I don't want to have my password written out in a file. I'm trying to use https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token (PAT) from Github but I get authentication error. Is there an issue using PAT?
For security reasons I don't want to have my password written out in a file. I'm trying to use
(PAT) from Github but I get authentication error. Is there an issue using PAT?
There shouldn't be any issue - they can be used as regular passwords... Maybe the issue is your Trains Agent can't locate the configuration? When the Agent starts, you should see the git username printed out as part of the configuration dump - can you locate it?
but when I try to clone the repo directly, PAT works.
fatal: could not read Username for '
': terminal prompts disabled error: Could not fetch origin
Why is trains-agent trying read from terminal prompt instead of trains.conf
?
SarcasticSparrow10 is it possible you have a Keyring installed? If so, the reason is that the keyring tries to receive your input after the credentials are provided, but can't. You'll have to manually enter these credentials on the machine so that the keyring won't ask for your confirmation :)
This is probably git
, not Trains Agent...
I used trains-agent init
to create the config file