Giter VIP home page Giter VIP logo

Comments (3)

matteosister avatar matteosister commented on August 11, 2024

the permission that you would give to the user that uses git from the command line should be given to the server user. What problem do you have?

from gitelephant.

GenieTim avatar GenieTim commented on August 11, 2024

Thank you for your response (and the program as a whole). I will just sketch the developement and my findings for future interests:

It started with The path provided (/var/ftp/restOfPath) is not a valid git repository path. This could be resolved by adding rwx permissons to the path for www-data (the server-user).

Next up was Not a git repository (or any of the parent directories): .git which could be resolved by adding rwx permissions to the .git directory.

unable to access '.git/config': Permission denied was resolved, once again, by setting permissions to rwx.

Uncaught PHP Exception RuntimeException: "Exit code: 1 while executing: "/usr/bin/git pull '--rebase'" with reason: anyFile: Permission denied was the next upcoming which had to be resolved by adding x permission to all files in the repository.

So, in essence, to answer my own question, the whole repository including .git needs rwx-permissions. I am not exactly sure why every file needs the e_x_ecute permission, but it is like it is.

Currently, I am struggling with Uncaught PHP Exception RuntimeException: "Exit code: 1 while executing: "/usr/bin/git pull '--rebase'" with reason: Could not create directory '/var/www/.ssh'. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.. I suspect some changes to the id_rsa file are necessary and will update this post as soon as I found out.

from gitelephant.

GenieTim avatar GenieTim commented on August 11, 2024

Okay, the last follow-up as I finally managed to get everything working as intended:
To fix the ssh error, one has to create new ssh keys for the apache user like so: sudo -u apache ssh-keygen -t rsa. These will probably be saved to the home directory of the apache user, respectively e.g. /var/www/.ssh/. To enable the ssh-key, the public part has to be loaded at the remote-side, e.g. GitHub, as you do. Afterwards, the whole ssh-directory had to be added to the global ssh_config file (which has to be readable by the apache user) under Host with key IdentityFile. An alternative variant would be to use deploy keys.
To trust the connection, a connection has to be done once, e.g. using sudo -u apache git pull so you can type yes when asked if you want to trust the remote.
This is all to get ssh & git working with another user than the default.
In the end, I also got some ACL which prevented some commands, but that's probably not relevant for anyone else.

from gitelephant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.