Pushing and existing project into bare repo

前端 未结 1 1698
误落风尘
误落风尘 2021-01-22 18:47

I\'ve been working on a project locally using git and laravel. I\'ve finally decided to add a bare repo to our server in order to push the changes and automate deployment.

相关标签:
1条回答
  • 2021-01-22 19:32

    It looks like git-receive-pack is not on the path for the user configuration used to push to the repository. When you push to a git repository via ssh git will use ssh to execute commands on the remote server under the user account which is doing the push. These commands, such as git-receive-pack, must be available on that user's path on the server. To diagnose this I would start by executing the command

    ssh user@0.0.0.0 which git-receive-pack
    

    You will almost certainly get a command not found error. Next you could try

    ssh user@0.0.0.0 'echo $path' # Note the single quotes.
    

    This will show you what the user's path is on the remote server and may help you figure out what is wrong. Note the line in the ssh man page:

    ssh ... [user@]hostname [command]

    ...

    If command is specified, it is executed on the remote host instead of a login shell.

    This can be a subtle but important distinction as it means a login shell to the remote created with ssh user@0.0.0.0 may not see the same shell environment as a command run by ssh user@0.0.0.0 some remote command. This answer has an explanation of how this works for the bash shell, others behave similarly.

    0 讨论(0)
提交回复
热议问题