Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git clone failed when running in private repo #1

Closed
frederikheld opened this issue Nov 14, 2020 · 2 comments
Closed

git clone failed when running in private repo #1

frederikheld opened this issue Nov 14, 2020 · 2 comments

Comments

@frederikheld
Copy link

Hey @reuixiy,

thank you very much for the great work you have done with this action!

I have an issue with it though: I'm running it within an private repo and push the results to a public repo from where it is served via github actions. The action runs and pushes the results to the public repo, but I can only find XML files there. If I run the same build locally, I get the html and xml files. After some research, I found this issue:

[...]
Cloning into 'site'...
Warning: Permanently added the RSA host key for IP address 'x.x.x.x to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Start building sites … 
WARN 2020/11/14 23:25:59 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
[...]

As the generated XML files contain information from my repository (so the checkout of the main repo seems to work), I suspect that the action can't checkout the theme submodule (which is a public repo). This would explain the WARN's (this is only one of many) about missing layout files.

I found tons of discussions about the fact that actions/checkout@v2 has issues checking out private submodules. The solution is to add a personal access token. But the submodule I'm trying to clone is public (so it should be accessible) and belongs to someone I don't know, so I don't have the option to get an access token. I also don't know if I need actions/checkout@v2 at all, as your action has it's own checkout routine. So I'm a bit lost here...

Do you have any idea how I can fix this?

Thanks in advance,
Fred

@frederikheld
Copy link
Author

It happened as it always does: short after I posted the above question (which I did after 3 hours of research), I found a working solution: I added the following step before your script.

      # Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
      - name: 'Checkout Repository'
        uses: actions/checkout@v2
        with:
          submodules: true

Your action still fails to clone the submodules but it doesn't matter as it was already done in the step before. So the output looks like now:

[...]
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Start building sites … 
[...]

So no errors about missing layout files anymore :-)

I suggest that you remove the cloning step from your action and suggest the above step in the docs instead.

Cheers
Fred

@reuixiy
Copy link
Owner

reuixiy commented Nov 17, 2020

Hey @frederikheld,

Sorry for the inconvenience and delay.

Cloning into 'site'...
Warning: Permanently added the RSA host key for IP address 'x.x.x.x to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

So as the log you pasted shows, it's a permission issue caused by your main repo, which is a private repo, as you said.

Unfortunately, this action does not support private repo yet. But I'm glad that you have found the workaround :)

And thanks for your suggestion, but I may not replace the cloning step in entrypoint.sh with checkout action in workflow file. Since the reason I wrote this instead of using other existing actions is to keep everything simple (and runs on Arch Linux, YES!), which means no more other dependencies should be imported.

Though, I do should put some words about this in README.md. But time is not on my side recently... I just pinned this issue for temporarily. Feel free to fork this repo and improve the docs then submit a pull request if you wish.

Thanks!

@reuixiy reuixiy pinned this issue Nov 17, 2020
@reuixiy reuixiy changed the title Can't resolve git submodule when running in private repo git clone failed when running in private repo Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants