Laravel提交项目到git仓库并从git clone项目到本地操作流程

1.提交项目到git操作流程:

0. 登录github.com账号hengda-git并new一个新的仓库命名为laravel-test

Laravel提交项目到git仓库并从git clone项目到本地操作流程_第1张图片

1. 在项目目录下,执行初始化仓库命令
git init
已初始化空的 Git 仓库于 /home/wdh/D/nmpr/nginx/www2/www_test/blog/.git/
2. 查看状态
git status
位于分支 master

初始提交

未跟踪的文件:
  (使用 "git add <文件>..." 以包含要提交的内容)

        .env.example
        .gitattributes
        .gitignore
        app/
        artisan
        bootstrap/
        composer.json
        composer.lock
        config/
        database/
        learn.md
        package.json
        phpunit.xml
        public/
        readme.md
        resources/
        routes/
        server.php
        storage/
        tests/
        webpack.mix.js

提交为空,但是存在尚未跟踪的文件(使用 "git add" 建立跟踪)

3. 添加文件到仓库
git add -A
warning: 文件 public/request.log 中的 CRLF 将被 LF 替换。
在工作区中该文件仍保持原有的换行符。

4. 配置仓库全局参数 user.email (首次使用需要)

提交仓库到远程注释内容:‘init’

git commit -m 'init'
*** 请告诉我你是谁。

运行

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

来设置您账号的缺省身份标识。
如果仅在本仓库设置身份标识,则省略 --global 参数。
fatal: empty ident name (for <(null)>) not allowed

git config --global user.email "[email protected]"
5. 配置仓库全局参数user.name (首次使用需要)
git config --global user.name "hengda"
6. 提交仓库到远程注释内容:‘init’
git commit -m 'init'
[master(根提交) 3ccef1c] init
 114 files changed, 10912 insertions(+)
 create mode 100644 .env.example
 create mode 100644 .gitattributes
 create mode 100644 .gitignore
 create mode 100644 app/Console/Kernel.php
 create mode 100644 app/Exceptions/Handler.php
 create mode 100644 app/Http/Controllers/Auth/ForgotPasswordController.php
 create mode 100644 app/Http/Controllers/Auth/LoginController.php
 create mode 100644 app/Http/Controllers/Auth/RegisterController.php
 create mode 100644 app/Http/Controllers/Auth/ResetPasswordController.php
 create mode 100644 app/Http/Controllers/Controller.php
 create mode 100644 app/Http/Controllers/DBController.php
 create mode 100644 app/Http/Controllers/HomeController.php
 create mode 100644 app/Http/Controllers/TieziController.php
 create mode 100644 app/Http/Controllers/UserController.php
 create mode 100644 app/Http/Kernel.php
 create mode 100644 app/Http/Middleware/EncryptCookies.php
 create mode 100644 app/Http/Middleware/LoginMiddleware.php
 create mode 100644 app/Http/Middleware/RecordMiddleware.php
 create mode 100644 app/Http/Middleware/RedirectIfAuthenticated.php
 create mode 100644 app/Http/Middleware/TrimStrings.php
 create mode 100644 app/Http/Middleware/TrustProxies.php
 create mode 100644 app/Http/Middleware/VerifyCsrfToken.php
 create mode 100644 app/Providers/AppServiceProvider.php
 create mode 100644 app/Providers/AuthServiceProvider.php
 create mode 100644 app/Providers/BroadcastServiceProvider.php
 create mode 100644 app/Providers/EventServiceProvider.php
 create mode 100644 app/Providers/RouteServiceProvider.php
 create mode 100644 app/User.php
 create mode 100644 artisan
 create mode 100644 bootstrap/app.php
 create mode 100644 bootstrap/cache/.gitignore
 create mode 100644 composer.json
 create mode 100644 composer.lock
 create mode 100644 config/app.php
 create mode 100644 config/auth.php
 create mode 100644 config/broadcasting.php
 create mode 100644 config/cache.php
 create mode 100644 config/database.php
 create mode 100644 config/filesystems.php
 create mode 100644 config/mail.php
 create mode 100644 config/queue.php
 create mode 100644 config/services.php
 create mode 100644 config/session.php
 create mode 100644 config/view.php
 create mode 100644 database/.gitignore
 create mode 100644 database/factories/UserFactory.php
 create mode 100644 database/migrations/2014_10_12_000000_create_users_table.php
 create mode 100644 database/migrations/2014_10_12_100000_create_password_resets_table.php
 create mode 100644 database/migrations/2020_03_27_151114_create_table_tiezi.php
 create mode 100644 database/seeds/DatabaseSeeder.php
 create mode 100644 learn.md
 create mode 100644 package.json
 create mode 100644 phpunit.xml
 create mode 100644 public/.htaccess
 create mode 100644 public/1.php
 create mode 100644 public/css/app.css
 create mode 100644 public/favicon.ico
 create mode 100644 public/images/8Ygi31umi3qzbFbKXrrhZ7hs4JiNvySrNKKQ5GnN.png
 create mode 100644 public/index.php
 create mode 100644 public/js/app.js
 create mode 100644 public/request.log
 create mode 100644 public/robots.txt
 create mode 100644 public/web.config
 create mode 100644 readme.md
 create mode 100644 resources/assets/js/app.js
 create mode 100644 resources/assets/js/bootstrap.js
 create mode 100644 resources/assets/js/components/ExampleComponent.vue
 create mode 100644 resources/assets/sass/_variables.scss
 create mode 100644 resources/assets/sass/app.scss
 create mode 100644 resources/lang/en/auth.php
 create mode 100644 resources/lang/en/pagination.php
 create mode 100644 resources/lang/en/passwords.php
 create mode 100644 resources/lang/en/validation.php
 create mode 100644 resources/views/add.blade.php
 create mode 100644 resources/views/admin1.blade.php
 create mode 100644 resources/views/auth/login.blade.php
 create mode 100644 resources/views/auth/passwords/email.blade.php
 create mode 100644 resources/views/auth/passwords/reset.blade.php
 create mode 100644 resources/views/auth/register.blade.php
 create mode 100644 resources/views/control.blade.php
 create mode 100644 resources/views/errors/404.blade.php
 create mode 100644 resources/views/home.blade.php
 create mode 100644 resources/views/layouts/app.blade.php
 create mode 100644 resources/views/layouts/footer.blade.php
 create mode 100644 resources/views/layouts/header.blade.php
 create mode 100644 resources/views/layouts/home.blade.php
 create mode 100644 resources/views/page1.blade.php
 create mode 100644 resources/views/page2.blade.php
 create mode 100644 resources/views/tiezi/create.blade.php
 create mode 100644 resources/views/tiezi/edit.blade.php
 create mode 100644 resources/views/tiezi/form.blade.php
 create mode 100644 resources/views/user.blade.php
 create mode 100644 resources/views/user/add.blade.php
 create mode 100644 resources/views/view.blade.php
 create mode 100644 resources/views/welcome.blade.php
 create mode 100644 routes/api.php
 create mode 100644 routes/channels.php
 create mode 100644 routes/console.php
 create mode 100644 routes/web.php
 create mode 100644 server.php
 create mode 100644 storage/app/.gitignore
 create mode 100644 storage/app/public/.gitignore
 create mode 100644 storage/debugbar/.gitignore
 create mode 100644 storage/framework/.gitignore
 create mode 100644 storage/framework/cache/.gitignore
 create mode 100644 storage/framework/sessions/.gitignore
 create mode 100644 storage/framework/testing/.gitignore
 create mode 100644 storage/framework/views/.gitignore
 create mode 100644 storage/logs/.gitignore
 create mode 100644 tests/CreatesApplication.php
 create mode 100644 tests/Feature/ExampleTest.php
 create mode 100644 tests/TestCase.php
 create mode 100644 tests/Unit/ExampleTest.php
 create mode 100644 webpack.mix.js
7. 指定远程仓库地址
git remote add origin https://github.com/hengda-git/laravel-test.git
8. 将本地仓库新增文件push到远程的仓库的master分支
git push -u origin master
9. 提示登录账号时输入用户名:
hengda-git
10. 提示输入密码时,输入git账号hengda-git对应的密码:
11. 等待上传完成即可
Username for 'https://github.com': hengda-git
Password for 'https://[email protected]': 
对象计数中: 149, 完成.
Delta compression using up to 8 threads.
压缩对象中: 100% (131/131), 完成.
写入对象中: 100% (149/149), 287.87 KiB | 0 bytes/s, 完成.
Total 149 (delta 19), reused 0 (delta 0)
remote: Resolving deltas: 100% (19/19), done.
To https://github.com/hengda-git/laravel-test.git
 * [new branch]      master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。

克隆项目到本地流程:

1. 克隆远程git账号hengda-git下的laravel-test项目到本地,并指定目录名称为 blog2:
gid clone https://github.com/hengda-git/laravel-test.git blog2
正克隆到 'blog2'...
remote: Enumerating objects: 152, done.
remote: Counting objects: 100% (152/152), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 152 (delta 21), reused 147 (delta 19), pack-reused 0
接收对象中: 100% (152/152), 288.62 KiB | 53.00 KiB/s, 完成.
处理 delta 中: 100% (21/21), 完成.

2. 在目录blog2下,执行composer install命令,安装laravel项目依赖包:
composer install
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 80 installs, 0 updates, 0 removals
  - Installing kylekatarnls/update-helper (1.2.0): Loading from cache
  - Installing symfony/thanks (v1.2.5): Loading from cache
  - Installing symfony/finder (v3.4.38): Loading from cache
  - Installing psr/log (1.1.2): Loading from cache
  - Installing symfony/debug (v3.4.38): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.14.0): Loading from cache
  - Installing symfony/var-dumper (v3.4.38): Loading from cache
  - Installing maximebf/debugbar (v1.15.1): Loading from cache
  - Installing symfony/polyfill-ctype (v1.14.0): Loading from cache
  - Installing vlucas/phpdotenv (v2.6.1): Loading from cache
  - Installing symfony/css-selector (v3.4.38): Loading from cache
  - Installing tijsverkoyen/css-to-inline-styles (2.2.2): Loading from cache
  - Installing symfony/routing (v3.4.38): Loading from cache
  - Installing symfony/process (v3.4.38): Loading from cache
  - Installing symfony/polyfill-util (v1.14.0): Loading from cache
  - Installing symfony/polyfill-php56 (v1.14.0): Loading from cache
  - Installing paragonie/random_compat (v9.99.99): Loading from cache
  - Installing symfony/polyfill-php70 (v1.14.0): Loading from cache
  - Installing symfony/http-foundation (v3.4.38): Loading from cache
  - Installing symfony/event-dispatcher (v3.4.38): Loading from cache
  - Installing symfony/http-kernel (v3.4.38): Loading from cache
  - Installing symfony/console (v3.4.38): Loading from cache
  - Installing symfony/polyfill-php72 (v1.14.0): Loading from cache
  - Installing symfony/polyfill-intl-idn (v1.14.0): Loading from cache
  - Installing symfony/polyfill-iconv (v1.14.0): Loading from cache
  - Installing doctrine/lexer (1.0.2): Loading from cache
  - Installing egulias/email-validator (2.1.17): Loading from cache
  - Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
  - Installing ramsey/uuid (3.9.3): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/translation (v3.4.38): Loading from cache
  - Installing nesbot/carbon (1.39.1): Loading from cache
  - Installing mtdowling/cron-expression (v1.2.3): Loading from cache
  - Installing monolog/monolog (1.25.3): Loading from cache
  - Installing league/flysystem (1.0.65): Loading from cache
  - Installing erusev/parsedown (1.7.4): Loading from cache
  - Installing doctrine/inflector (v1.2.0): Loading from cache
  - Installing laravel/framework (v5.5.48): Loading from cache
  - Installing barryvdh/laravel-debugbar (v3.2.9): Loading from cache
  - Installing fideloper/proxy (3.3.4): Loading from cache
  - Installing jakub-onderka/php-console-color (v0.2): Loading from cache
  - Installing nikic/php-parser (v4.3.0): Loading from cache
  - Installing jakub-onderka/php-console-highlighter (v0.4): Loading from cache
  - Installing dnoegel/php-xdg-base-dir (v0.1.1): Loading from cache
  - Installing psy/psysh (v0.9.12): Loading from cache
  - Installing laravel/tinker (v1.0.10): Loading from cache
  - Installing predis/predis (v1.1.1): Loading from cache
  - Installing filp/whoops (2.7.1): Loading from cache
  - Installing fzaninotto/faker (v1.9.1): Loading from cache
  - Installing hamcrest/hamcrest-php (v2.0.0): Loading from cache
  - Installing mockery/mockery (1.3.1): Loading from cache
  - Installing webmozart/assert (1.7.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.5.1): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.4): Loading from cache
  - Installing phpunit/php-token-stream (2.0.2): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.2): Loading from cache
  - Installing sebastian/environment (3.1.0): Loading from cache
  - Installing sebastian/diff (2.0.1): Loading from cache
  - Installing sebastian/comparator (2.1.3): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/phpunit-mock-objects (5.0.10): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.5): Loading from cache
  - Installing theseer/tokenizer (1.1.3): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-code-coverage (5.3.2): Loading from cache
  - Installing phpspec/prophecy (v1.10.3): Loading from cache
  - Installing phar-io/version (1.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.1): Loading from cache
  - Installing myclabs/deep-copy (1.7.0): Loading from cache
  - Installing phpunit/phpunit (6.5.14): Loading from cache
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/var-dumper suggests installing ext-symfony_debug
maximebf/debugbar suggests installing kriswallsmith/assetic (The best way to manage assets)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
symfony/console suggests installing symfony/lock
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
swiftmailer/swiftmailer suggests installing ext-intl (Needed to support internationalized email addresses)
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)
ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing paragonie/random-lib (Provides RandomLib for use with the RandomLibAdapter)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.5).)
laravel/framework suggests installing guzzlehttp/guzzle (Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use Flysystem caching (~1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (~1.0).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~3.0).)
laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (~3.3).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (~1.0).)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
predis/predis suggests installing ext-curl (Allows access to Webdis when paired with phpiredis)
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing ext-xdebug (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
6 packages you are using are looking for funding.
Use the composer fund command to find out more!

  • composer install 安装过程报错,可以尝试删除 composer.lock 文件,然后重新执行 composer install
3. 在web服务器(我的是nginx)配置文件添加clone文件目录的web访问地址:deepin-blog2.com
(base) wdh@wdh:~/D/nmpr/nginx/conf2.d$ cat blog2.conf 
server {
    listen       80;
    server_name  deepin-blog2.com www.deepin-blog2.com;

    location / {
        root   /usr/share/nginx/html/www_test/blog2/public;
        index index.php index.html index.htm server.php;
	
    	#开启后忽略入口文件
	if (!-e $request_filename) {
		rewrite  ^(.*)$  /index.php$1  last;
		break;
	}
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html/www_test/blog2/public;
    }

    location ~ \.php(.*)$ {
	#fastcgi_pass	php:9000;
	fastcgi_pass	172.17.1:9001;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /www/www_test/blog2/public/$fastcgi_script_name;
        include        fastcgi_params;
    }
}
4. 在hosts文件中添加 解析记录 127.0.0.1 deepin.blog2.com
127.0.0.1 deepin-blog2.com
127.0.0.1 www.deepin-blog2.com
5. 用浏览器测试访问:deepin-blog2.com

Laravel提交项目到git仓库并从git clone项目到本地操作流程_第2张图片

你可能感兴趣的:(Laravel,git,PHP)