# Mirroring from GitHub. How to Auth

**URL:** <https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210>\
**Category:** SCM-Manager Plugins\
**Created:** [August 1, 2023, 6:55pm UTC](https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210 "2023-08-01T18:55:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danlawit](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/danlawit/32/1496_2.png) [@danlawit](https://community.cloudogu.com/u/danlawit)\
**Post date:** [August 1, 2023, 6:55pm UTC](https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210/1 "2023-08-01T18:55:32Z")

</div>

Hello,  
I’m trying to find mirror a repo from github to scm. I’ve tried the mirror plugin but since github does not allow basic auth anymore, the plugin does not seem like would work for this task.  
I’ve tried converting my private ssh key to p12 and using it that way, but that does not seem to work.  
Is there a possibility to add ssh mirroring option, or https with token or gpg auth?

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [August 1, 2023, 7:14pm UTC](https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210/2 "2023-08-01T19:14:19Z")

</div>

Hey, the mirror plugin can work with GitHub. You have to create and use a personal API token.

> **[Managing your personal access tokens - GitHub Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)**
>
> You can use a personal access token in place of a password when authenticating to GitHub in the command line or with the API.

---

<div class="post-metadata">

**Author:** ![danlawit](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/danlawit/32/1496_2.png) [@danlawit](https://community.cloudogu.com/u/danlawit)\
**Post date:** [August 3, 2023, 5:36pm UTC](https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210/3 "2023-08-03T17:36:04Z")

</div>

Anything more specific, on how it can work ?  
If I setup basic auth with username and use the personal API Token as the password (the way the documentation shows), I’m getting an exception from jgit:  
2023-08-03 13:22:29.038 [pool-6-thread-3] [] INFO sonia.scm.repository.spi.GitMirrorCommand - got exception while trying to synchronize mirror for repository git/testmirror (1yTltLJAGbm)  
org.eclipse.jgit.api.errors.TransportException: [https://URLXXXXXX/YYYY.git:](https://URLXXXXXX/YYYY.git:) git-upload-pack not permitted on ‘[https://URLXXXXXX/YYYY.git/](https://URLXXXXXX/YYYY.git/)’  
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:224)  
at sonia.scm.repository.spi.GitMirrorCommand$Worker.doUpdate(GitMirrorCommand.java:201)  
at sonia.scm.repository.spi.GitMirrorCommand$Worker.run(GitMirrorCommand.java:190)  
at sonia.scm.repository.spi.GitMirrorCommand$Worker.run(GitMirrorCommand.java:161)  
at sonia.scm.repository.spi.AbstractGitCommand.inClone(AbstractGitCommand.java:138)  
at sonia.scm.repository.spi.GitMirrorCommand.update(GitMirrorCommand.java:145)  
at sonia.scm.repository.api.MirrorCommandBuilder.update(MirrorCommandBuilder.java:134)  
at com.cloudogu.scm.mirror.MirrorCommandCaller.call(MirrorCommandCaller.java:86)  
at com.cloudogu.scm.mirror.MirrorWorker.startSynchronously(MirrorWorker.java:149)  
at com.cloudogu.scm.mirror.MirrorWorker.lambda$startAsynchronously$4(MirrorWorker.java:136)  
at sonia.scm.web.security.DefaultAdministrationContext.runAsAdmin(DefaultAdministrationContext.java:83)  
at com.cloudogu.scm.mirror.TaskDecoratorFactory.lambda$asAdmin$1(TaskDecoratorFactory.java:59)  
at com.cloudogu.scm.mirror.TaskDecoratorFactory.lambda$withTryCatch$0(TaskDecoratorFactory.java:51)  
at com.cloudogu.scm.mirror.MirrorWorker.lambda$startAsynchronously$5(MirrorWorker.java:136)  
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)  
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)  
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)  
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  
at java.base/java.lang.Thread.run(Thread.java:829)  
Caused by: org.eclipse.jgit.errors.TransportException: [https://URLXXXXXX/YYYY.git:](https://URLXXXXXX/YYYY.git:) git-upload-pack not permitted on ‘[https://URLXXXXXX/YYYY.git/](https://URLXXXXXX/YYYY.git/)’  
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:692)  
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:465)  
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:151)  
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:103)  
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1321)  
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:213)  
… 19 common frames omitted

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [August 8, 2023, 7:36am UTC](https://community.cloudogu.com/t/mirroring-from-github-how-to-auth/1210/4 "2023-08-08T07:36:29Z")

</div>

I reproduced your case. First i tried to import a private GitHub repository using a `fine-grained token` with the required permissions. This did not work…

Afterwards i tried the same with a `classic token` with full `repo` permissions and works like a charm. I don’t know why the first attempt failed. Could you also try the classic token? I set the classic token as my password on the SCM import form.

 ![Screenshot from 2023-08-08 09-31-05](https://europe1.discourse-cdn.com/flex013/uploads/cloudogu2/original/2X/6/64d6a72229301df03fcf5c1c2f3cd02d242e4b16.png)
