将本地laravel项目与现有的git存储库同步 [英] Syncing local laravel project with existing git repository

查看:428
本文介绍了将本地laravel项目与现有的git存储库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个已经在git上的laravel项目的本地工作环境。我已经安装了一切。 学习-laravel 项目已经完成并正在开展工作。



如果我只是克隆了git repo,我可以使用它,在服务器上执行所有操作,但无法在本地执行,这很明显,因为大部分文件夹/文件都位于.gitignore文件中。这是项目的.gitignore文件

  /bootstrap/compiled.php 
/供应商
作曲家。 phar
composer.lock
.env。*。php
.env.php
.DS_Store
Thumbs.db
.idea /

因为我对laravel和git比较陌生。这就是我迄今为止所做的。我已经通过作曲家创建了一个laravel项目,并尝试将它与我们的git repo同步。

  cd项目
git init
git remote add origin url_on_github
git pull

当我做<$ c $时c> git pull 它似乎是从git repo中获取代码,并在100%给出某种类型的git错误之后



当前分支没有跟踪信息。请指定要与哪个分支合并.....



使用 git pull origin master ,但是也出现错误
错误:未绑定的工作树文件'.gitattributes'将被合并覆盖。 ,当然还有很多未跟踪的文件。



我也尝试了更多,但这是我一直在做的事情的总结。所以,我这样做有点困惑。任何帮助将大大受益于为已经有git repo的laravel项目设置本地工作环境。 首先不需要安装Laravel。您应该:


  • 从Github本地克隆git仓库:

     $ git clone url_on_github 


  • 安装Laravel软件包依赖关系with Composer:

      $作曲家安装


  • 设置一些Laravel文件夹的权限:

      $ chmod -R 775 app /存储



I am trying to set up a local working environment of a laravel project which is already on git. I have installed everything. learning-laravel project is all set and working.

If i just clone the git repo i am able to use it, do everything on server but unable to execute locally, and that is obvious because most of the folders/file are in .gitignore file. Here is .gitignore file of the project

/bootstrap/compiled.php
/vendor
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
Thumbs.db
.idea/ 

As i am relatively new to laravel and git. That is what i have done so far. I have created a laravel project through composer and tried to sync it with our git repo

cd project
git init
git remote add origin url_on_github
git pull

when i do git pull it seems to be fetching the code from git repo and after 100% gives some kind of git error

There is no tracking information for the current branch.Please specify which branch you want to merge with.....

Than i used git pull origin master but that also gives an error error: Untracked working tree file '.gitattributes' would be overwritten by merge. and there are of course many untracked files.

I also have tried much more but that was a summary of what i have been doing. So, i am bit confused while doing this. Any help will be largely appreciated to setup the local working environment for a laravel project which already has a git repo.

解决方案

You should not have to install Laravel first. You should:

  • Clone locally the git repo from Github:

    $ git clone url_on_github
    

  • Install Laravel packages dependencies with Composer:

    $ composer install
    

  • Set permissions to some Laravel folders:

    $ chmod -R 775 app/storage
    

这篇关于将本地laravel项目与现有的git存储库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆