[英]Git not pushing new files to remote repository
I am using a push-to-deploy method to put out changes to a project. 我正在使用“按部署”方法来发布对项目的更改。 How I've done this is as follows:
我如何做到的如下:
git config receive.denyCurrentBranch false
for this project on the remote server (if I set this to true I get errorrs) to allow me to push from dev. git config receive.denyCurrentBranch false
设置为git config receive.denyCurrentBranch false
(如果我将其设置为true,则会得到错误提示),以允许我从开发者那里推送。 Otherwise I get an error telling me to do so. git reset HEAD
and git checkout
. git reset HEAD
和git checkout
。 This will overwrite the previous version on remote directory with the newly pushed version. This works fine and my changes to files appear in the checked out branch on the remote server. 这可以正常工作,并且我对文件的更改显示在远程服务器上的检出分支中。 I only have one remote repository too this way.
这样我也只有一个远程存储库。 Previously I had a bare repository and used a post-update hook there to pull the project to the live directory (resulting in two repos on remote - bare and pulled repo)
以前我有一个裸仓库,并在那里使用更新后挂钩将项目拉到活动目录(导致在远程上有两个仓库-裸仓库和拉仓库)
Anyway, where this isn't working is when I create a NEW file on my local development environment and add, commit and push the changes. 无论如何,当我在本地开发环境上创建一个新文件并添加,提交和推送更改时,这是行不通的。 I don't get any errors.
我没有任何错误。 Also, if I try to push again it tells me that everything is up to date.
另外,如果我尝试再次推送,它会告诉我所有内容都是最新的。 But, the new file is not on the remote server.
但是,新文件不在远程服务器上。 Why?
为什么?
I'm not sure if the new files aren't being commited to local git, pushed to remote or not checking out. 我不确定新文件是否未提交到本地git,是否推送到远程或未检出。 Is there any reason for this?
有什么理由吗? Do I need to specify some option somewhere?
我需要在某处指定一些选项吗?
UPDATE 更新
If I try to checkout the file in development on my local repo it's fine. 如果我尝试在本地回购中检出开发中的文件,那就很好。 So it seems the file has been commited to there.
因此,似乎文件已提交到那里。 So at some point between pushing to remote, and then reset/checkout there I've not set things up correctly.
因此,在推送到远程,然后重新设置/签出之间的某个时间点,我还没有进行正确的设置。
My advice is to use only one bare
repo on the remote server with combination of post-receive
hook. 我的建议是在远程服务器上仅使用一个
bare
仓库,结合post-receive
挂钩。
The hook should look like: 钩子应该看起来像:
git --work-tree=/path/to/the/live/site checkout -f master
For the missing file I guess the issue is that you are commiting the file in different branch, say dev
and on the live server you are checking out the branch master
where this file do not exists. 对于丢失的文件,我想问题是您要在其他分支(例如
dev
中提交文件,并且在实时服务器上要签出该文件不存在的分支master
服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.