熱門文章

顯示具有 git 標籤的文章。 顯示所有文章
顯示具有 git 標籤的文章。 顯示所有文章

2016年6月17日 星期五

[Openshift] git clone

$ git clone <git_url> <directory to create>


So I tried to run it as suggested:
submodule add -f http://git.drupal.org/project/token.git /sites/all/modules/token
But this throws this error:
fatal: could not create leading directories of '/sites/all/modules/token': Permission denied
Clone of 'http://git.drupal.org/project/token.git' into submodule path '/sites/all/modules/token' failed
Permissions are 777.
Ideas?
Just found the answer: 
git submodule add http://git.drupal.org/project/token.git sites/all/modules/token
The leading "/" was the problem.

提問者多打了一個"/"導致錯誤的發生

[Openshift]使用 rhc 下載複製(clone)程式碼

➜  ~ git:(master) rhc setup
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other
programs like Git are properly installed.

If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for
OpenShift Online: openshift.redhat.com.
Enter the server hostname: |openshift.redhat.com| 

You can add more servers later using 'rhc server'.

Login to openshift.redhat.com: qjpioneer@gmail.com
Password: ********

OpenShift can create and store a token on disk which allows to you to access the server without using your
password. The key is stored in your home directory and should be kept secret.  You can delete the key at
any time by running 'rhc logout'.
Generate a token now? (yes|no) yes
Generating an authorization token for this client ... lasts about 1 month

Saving configuration to /Users/QJpioneer/.openshift/express.conf ... done

Checking for git ... found git version 2.7.4 (Apple Git-66)


Checking common problems .Enter passphrase for /Users/QJpioneer/.ssh/id_rsa: 


rhc setup

enter

email
pw
yes




今天因為修改了架設在openshift上的wordpess 的後台位置,導致我無法正常連上後台(前台都正常),回到openshift的頁面才發現,我設置的是scalable app所以無法直接安裝phpmyadmin

Installing phpMyAdmin on openshift scalable app

其中有要設置 rhc 


參考1. stackoverflow

Remove the keys: rhc sshkey-remove You can also delete them from the management console, by going to https://openshift.redhat.com/app/console/settingsOnce done, upload the public key (copy the content of your id_rsa.pub to management console) :https://openshift.redhat.com/app/console/keys/newSave it. After this try to git clone and it should work for you.

參考2. 怎樣使用git把程式碼搬到OpenShift?

我在設定 rhc setup 時搞了很久,才發現必須先按一個enter,下一行才是輸入信箱與密碼來登入openshift,在這裡失敗了好就都不知道爲什麼....

Unable to connect to the server (getaddrinfo: nodename nor servname provided, or
not known (ssh:443)). Check that you have correctly specified your OpenShift
server
'https://ssh//56c968760c1e6696010000d5@wp-qjpioneer.rhcloud.com/~/git/wp.git/'.
這部分成功後,又卡在
Checking common problems .Enter passphrase for /Users/QJpioneer/.ssh/id_rsa: 
Enter passphrase for /Users/QJpioneer/.ssh/id_rsa: 
Enter passphrase for /Users/QJpioneer/.ssh/id_rsa: 


An SSH connection could not be established to my-qjpioneer.rhcloud.com. Your SSH configuration may not be
correct, or the application may not be responding. Could not parse PKey: no start line (ArgumentError)

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
這裡我不知道要輸入什麼,找了很久(還用finder去找這個資料夾,不知怎麼看OS X系統(Mac)的隱藏資料夾而繞了一大圈,也不在裡面。

後來才想到跟git 有關,去github 也沒有....最後最後,因為我有用evernote記錄註冊的帳號密碼(當然,重要的事不會記在這),終於被我找到了

輸入後可以成功clone檔案到本機了!!
接下來才是安裝phpmyadmin的步驟啊...

2016年6月10日 星期五

Heroku 上傳之筆記

Heroku是一個支持多種程式語言的雲平台即服務。Heroku作為最開始的雲平台之一,從2007年6月起開發,當時它僅支持Ruby,但後來增加了對Java、Node.js、Scala、Clojure、Python以及PHP和Perl的支持。
Step 1: 上 Heroku 官網http://heroku.com 註冊帳號。(請在 Heroku、Git、GitHub、SSH 使用相同的 Email。)
Step 2: 請上 https://toolbelt.heroku.com/ ,下載heroku toolbelt,並安裝。

2016年2月29日 星期一

[Rails]deploy to Heroku




完成一個階段後,更新git,上傳到heroku

資料庫
https://mysterious-gorge-11470.herokuapp.com

deploy 新版程式的方法


步驟 1:把所有異動都 commit 進 git

Heroku 只受理我們有 commit 進本地 git repo 的程式,所以要確定修改過的檔案都有 commit 進去了。
在終端機打這些字:
git status
git status 顯示你還沒 commit 進 git 的異動。如果沒有輸出任何東西的話,那你可以 deploy 了!不然的話就要 commit 程式碼進去:
在終端機打這些字:
git add .
git commit -m "Some helpful message for your future self"
Commit message 應該要可以描述你這次修改了什麼東西,像是:「把投票數加到 topics 列表頁」

步驟 2:把異動 push(上傳)到 Heroku

在終端機打這些字:
git push heroku master
這樣子會把本地所有已經 commit 進去的異動都 push 到 Heroku。

步驟 3:在 Heroku 跑資料庫的 migration

在終端機打這些字:
heroku run rake db:migrate
這是叫 Heroku 在它的資料庫跑 migration,作用就像我們在本地跑 rake db:migrate。Heroku 的資料庫跟你電腦上的資料庫是分開的,也就是說每一次你更改了資料庫的結構,你都要在 Heroku 的資料庫更新一次。這也就是說在 Heroku 上面你不會看到你電腦上的 sqlite3 資料庫裡面的資料。

步驟 4:上網看你的程式

在終端機打這些字:
heroku open
會在瀏覽器打開你上傳到 Heroku 的程式。


以上轉至 http://railsbridge-docs-zh-tw.herokuapp.com/初探-rails/deploy_到_heroku?back=設定首頁#every-time

Git


git add
在 Git 裡,有多個指令可以做到類似的事:
  • git add foo.txt 把名叫 foo.txt 的檔案加進追蹤修訂。
  • git add . ("git add dot") 把所有新檔案和改過的檔案加進追蹤修訂,但「保留」你刪掉的檔案。
  • git add -A 全部加進追蹤修訂,包括刪掉的檔案。
「把刪掉的檔案加進來」聽起來很奇怪,但如果你把版本控制系統想像成是追蹤「修改」的工具,或許就會懂了。 多數人用 git add . 但 git add -A 會比較安全。無論無何,git status 都能幫上你的忙。



http://railsbridge-docs-zh-tw.herokuapp.com/初探-rails/把專案加進_git_repo?back=開始吧!







git add .
git commit -m "Added all the things"