Laravel提交項目到git倉庫並從git clone項目到本地操作流程

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

0. 登錄github.com賬號hengda-git並new一個新的倉庫命名爲laravel-test

在這裏插入圖片描述

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

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章