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

"Error: cannot run less: No such file or directory" in dev container #23

Open
vonjackets opened this issue Dec 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vonjackets
Copy link
Collaborator

vonjackets commented Dec 2, 2024

Description:
Git operations that use a pager (e.g., git log, git diff) fail with the following error when run inside the devcontainer.

error: cannot run less: No such file or directory
fatal: unable to execute pager 'less'

Reproducing the issue
Run the devcontainer on your machine, access the shell within it via docker exec or through the code-server web ui.
docker run -it -v $pwd):/workspace -p 8080:8080 polar-dev:latest bash -c "/create-user.sh $(whoami) $(id -u) $(id -g)"/

Then, try to run git branch or any other git operation that requires a pager.

Possible Cause:
This error typically occurs when the less command-line utility, which Git uses as the default pager for displaying output, is not installed on the system or is not accessible in the system's PATH.


Potential Solutions:
(Provide suggestions or troubleshooting steps here. Contributors can add more ideas as needed.)

  • We could just Install less adding it to the flake definition.

  • Change Git Pager Configuration to use bat
    For example:
    git config --global core.pager "bat"

We can probably avoid this entirely if we create a symlink from less to bat in the flake definition. If we haven't yet mounted a git config, this may be the time to do it with some other quality of life improvements.


Feel free to suggest additional solutions in the comments.

@vonjackets vonjackets added the bug Something isn't working label Dec 3, 2024
@vonjackets vonjackets self-assigned this Dec 3, 2024
@vonjackets
Copy link
Collaborator Author

Seems like we may just be able to get away with specifying the GIT_PAGER variable to = "cat" or whatever pager we wish.
git -c core.pager="cat" <CMD> seems to be fine as a workaround til the change is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant