简体   繁体   English

如何在Windows上为导入的Laravel项目重新配置GIT并部署到Linux服务器

[英]How to reconfigure GIT for imported Laravel project on Windows and deploy to Linux server

I have a Laravel project copied from different computer and it used Git at that computer. 我有一个从另一台计算机复制的Laravel项目,并且在该计算机上使用了Git。

I run 'git add' and then 'git commit' , but I got error: 我先执行'git add'然后执行'git commit',但是出现错误:

fatal: could not parse HEAD'. 致命:无法解析HEAD'。 Then I run 'git fsck' to check. 然后我运行'git fsck'进行检查。 This is a log: 'Checking object directories: 100% (256/256), done. 这是一条日志:'检查对象目录:100%(256/256),已完成。 Checking objects: 100% (15395/15395), done. 检查对象:100%(15395/15395),已完成。 error: HEAD: invalid sha1 pointer 8969f7fc321490b0f8d716b4ec46806307047a46 error: refs/heads/master: invalid sha1 pointer 8969f7fc321490b0f8d716b4ec46806307047a46 error: refs/remotes/origin/HEAD: invalid sha1 pointer 8969f7fc321490b0f8d716b4ec46806307047a46 error: refs/remotes/origin/master: invalid sha1 pointer 8969f7fc321490b0f8d716b4ec46806307047a46 error: HEAD: invalid reflog entry 8969f7fc321490b0f8d716b4ec46806307047a46 error: refs/heads/master: invalid reflog entry 8969f7fc321490b0f8d716b4ec46806307047a46 error: refs/remotes/origin/master: invalid reflog entry 8969f7fc321490b0f8d716b4ec46806307047a46 dangling blob 670ada327a149925c76a58ca40e45639dea68520 dangling blob 180cac293ee826b9db692dd1c33aacc88b9c7e6a dangling blob 183903d3c3e4c6d7d8c42e0e19512f65b4fd2364 dangling blob db68ddf31bf9c0b97b2976134d0aab0dc5a7f182 dangling blob 88752d671f4f04cfadf764c17bb7fe2958e4d074 dangling blob a28c5281ec1d94d711559c9a1e6b301afdfcdad6 dangling blob 2eb64b853146373317416b443068604175ffec52 错误:HEAD:无效SHA1指针8969f7fc321490b0f8d716b4ec46806307047a46错误:参/头/主:无效SHA1指针8969f7fc321490b0f8d716b4ec46806307047a46错误:参/遥控器/来源/ HEAD:无效SHA1指针8969f7fc321490b0f8d716b4ec46806307047a46错误:参/遥控器/来源/主:无效SHA1指针8969f7fc321490b0f8d716b4ec46806307047a46错误: HEAD:无效引用日志条目8969f7fc321490b0f8d716b4ec46806307047a46错误:裁判/头/主:无效引用日志条目8969f7fc321490b0f8d716b4ec46806307047a46错误:裁判/遥控器/产地/主:无效引用日志条目8969f7fc321490b0f8d716b4ec46806307047a46晃来晃去的blob 670ada327a149925c76a58ca40e45639dea68520晃来晃去斑点180cac293ee826b9db692dd1c33aacc88b9c7e6a晃来晃去斑点183903d3c3e4c6d7d8c42e0e19512f65b4fd2364晃来晃去斑点db68ddf31bf9c0b97b2976134d0aab0dc5a7f182晃来晃去斑点88752d671f4f04cfadf764c17bb7fe2958e4d074晃来晃去的blob a28c5281ec1d94d711559c9a1e6b301afdfcdad6悬垂的斑点2eb64b853146373317416b443068604175ffec52 dangling blob 4dbf7a53323b624cb7bf6dab5ac256c02e3c9ac5' 悬空的斑点4dbf7a53323b624cb7bf6dab5ac256c02e3c9ac5'

I want to add the project to my Git and then deploy to the production server running on Linux Ubuntu. 我想将项目添加到我的Git中,然后部署到在Linux Ubuntu上运行的生产服务器上。 On production server there is also Git, so how to restore the project in my Git and deploy on server without loosing previous commits on Git on server. 在生产服务器上也有Git,因此如何还原我的Git中的项目并在服务器上进行部署,而又不会失去对服务器上Git的先前提交。

You have to clone the project on the target production server. 您必须在目标生产服务器上clone项目。

git clone git@yourserver

Then you have the last state that is included in the repository with the history. 然后,您将拥有历史记录包含在存储库中的最后一个状态。 Then you can pull the master branch if you want to deploy on your production system. 然后,如果要在生产系统上进行部署,则可以拉出master分支。

If your index is broken your can reset the index with the following command: 如果索引已损坏,则可以使用以下命令重置索引:

rm .git/index
git reset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM