從無到有開發自己的Wordpress部落客題---代碼環境準備

來源:互聯網
上載者:User

標籤:clu   版本庫   source   建立   壓縮包   log   plugin   curl -O   好處   

注意這裡說的是代碼環境準備哦,而不是L(M)AMP運行環境哦,運行環境會在後述文章中在寫。

一、在本地初始化git環境並且連結上gitee1、在gitee上建立一個項目託管你的代碼

這個不在贅述,按照提示一步一步操作就好了,個人使用者用gitee的好處是,相比於GitHub速度快,而且可以建立免費的私人庫。

2、建立公開金鑰以串連gitee

雖然主流git倉庫都支援http的方式,但是每次都要輸入密碼,麻煩。

建立方式參考:https://gitee.com/help/articles/4181 

3、在本地初始化git環境並且串連到gitee
//建立專案檔夾mkdir JerryBlog && cd JerryBlog//初始化git環境git init//串連遠程倉庫git remote add origin [email protected]:jerryqii/JerryBlog.git//拉取遠程代碼(其實也就只有README.md和.gitignore)git pull origin master
二、下載Wordpress源碼到本地1、下載並解壓Wordpress
//下載壓縮包curl -O https://wordpress.org/latest.tar.gz//解壓壓縮包tar -xvzf latest.tar.gz//把所有檔案移動到根目錄mv wordpress/* .//刪除空目錄以及壓縮包rmdir wordpress &&  rm latest.tar.gz
2、把Wordpress添加到gitignore

因為Wordpress經常會版本升級,所以不到萬不得已,我們不建議去修改他的源碼,所以面對這一坨不動的代碼,我們可以把它添加到gitignore。

# General.DS_Store.AppleDouble.LSOverride# Wordpress Source Code/wp-admin/wp-content/plugins/*/wp-content/themes/*!/wp-content/themes/JerryTheme/wp-content/index.php/wp-includes/index.php/license.txt/readme.html/wp-activate.php/wp-blog-header.php/wp-comments-post.php/wp-config-sample.php/wp-cron.php/wp-links-opml.php/wp-load.php/wp-login.php/wp-mail.php/wp-settings.php/wp-signup.php/wp-trackback.php/xmlrpc.php

如此,將只有我的部落客題代碼會在git中進行版本管理。

3、進行第一次git內容的提交

為了測試gitignore,我在部落格根目錄下建立了index.php和style.css兩個檔案,同時gitignore這個檔案也被修改了,下面我們進行第一次內容提交:

//添加所有為提交的檔案git add .//從暫存區提交到版本庫git commit -m "add git ignore"//推送到遠程倉庫git push origin master

這個時候可以看到gitee上已經有了剛才提交的檔案

從無到有開發自己的Wordpress部落客題---代碼環境準備

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.