[英]when i push to a remote repository in lightsail, git push is successfull but the source code is not there
我正在嘗試將AWS lightail用作后端node.js服務器。 我想自動化部署過程。 所以我用git init myproject.git --bare
在/home/bitnami/myproject.git中創建了一個git存儲庫
我還在/hooks
目錄中添加了一個文件,以便它將提取源代碼。 但是這部分不起作用。 這是我所做的: cat > post-receive
hooks
目錄中的cat > post-receive
。(我也嘗試使用文件名post-receive.sample
)下面是我在post-receive
文件中輸入的內容
#!/bin/sh
git --work-tree=/home/bitnami/my-repo --git-dir=/home/bitnami/myproject.git checkout -f
然后,我使用chmod +x post-receive
更改了新文件的權限,並在/home/bitnami
創建了my-repo
目錄。
然后從我的本地計算機推送到此倉庫。 沒有錯誤。 當我進入遠程服務器的/home/bitnami/myproject.git
目錄並鍵入`git log時,它會給我所有過去的git commit日志。 因此,連接似乎工作正常。 但是盡管添加了鈎子文件,我還是找不到任何地方的源代碼
嘗試:
checkout -f -- .
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.