Seeking Advice and Confirmation on GitHub Apps Authentication for Repository Synchronization with Copybara

44 views
Skip to first unread message

Juan Gu

unread,
Oct 23, 2023, 8:37:59 PM10/23/23
to Copybara OSS
Hi All,
I hope you’re doing well. I’m currently syncing from repoA to repoB using Copybara and have hit a bit of a snag with authenticating a GitHub app, which is the only entity with write access to repoB. Here’s the Docker command I’m using:

docker_cmd = [ "docker", "run", "-v", "~/.ssh:/root/.ssh", "-v", "~/mongodb-bot.gitconfig:/root/.gitconfig", "-v", f"{current_dir}/copybara.sky:/usr/src/app/copy.bara.sky", "-e", "COPYBARA_CONFIG=copy.bara.sky", "-e", "COPYBARA_SUBCOMMAND=migrate", "-e", "COPYBARA_OPTIONS=-v", "-e", f"GITHUB_TOKEN={access_token_copybara_syncer}", "copybara", "copybara" ]

I’m using GITHUB_TOKEN for authentication, but I’m not sure if this is the right way to go about it. Do you have any advice or suggestions?
Thanks
Juan 

Juan Gu

unread,
Oct 24, 2023, 7:26:56 PM10/24/23
to Copybara OSS

I have removed this line 'GITHUB_TOKEN' from the previous docker_cmd, instead, I have changed the desitnationURL in copybara.sky to 
destinationUrl ="https://x-access-token:<token>@github.com/xxx/xxx.git"
however, I am getting the error shows that 
remote: error: GH013: Repository rule violations found for refs/heads/v4.4. remote: Review all repository rules at http://github.com/xxx/xx/rules?ref=refs%2Fheads%2Fv4.4 remote: remote: - You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information. remote: To https://github.com/mongodb/mongo.git ! [remote rejected] HEAD -> v4.4 (push declined due to repository rule violations) error: failed to push some refs to 'https://github.com/xx/xx.git'
I have confirmed that my github apps do have read and write access to the content. 
Anyone can help? Thanks 


Mikel Alcon

unread,
Oct 26, 2023, 12:52:41 PM10/26/23
to Copybara OSS
Reply all
Reply to author
Forward
0 new messages