2012-04-22 158 views
4

我是使用Github的新手。Github:克隆存儲庫,更改克隆,並提交原始庫

我正在用計算機學習Ruby on Rails,併成功將所有內容都推送到了我的github存儲庫以及Heroku。

現在我正在使用與第一個不同的計算機。

的問題是,我該如何克隆我的github倉庫,更改代碼,並推動這些變化在GitHub上的原始資料庫,並希望進行這些更改的Heroku爲好。

+0

可能重複[Git for beginners:The definitive practical guide](http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide) – 2012-04-22 08:12:20

回答

1

當你從github克隆一個倉庫(並且你已經以github的形式登錄) 你有3個選項/鏈接來「克隆」你的Repo。

  1. SSH
  2. HTTP
  3. GIT只讀

如果您還沒有登錄,只有2個選項出現

  1. HTTP(只讀)
  2. GIT閱讀只有

在文件的.git/config中你可以看到你添加了一個,主要是在[遠程「原點」]

url = [email protected]:username/project.git (SSH) 

url = https://[email protected]/username/project.git (HTTP) 

url = https://github.com/username/project.git (HTTP Read only) 

url = git://github.com/username/project.git (Git Read only) 

如果選擇只讀,你能做的最好的就是刪除與遠程:

git remote rm origin

之後,你可以添加一個新的遠程:

git remote add origin https://[email protected]/username/project.git(用於HTTP)

git remote add origin [email protected]:username/project.git(用於SSH)​​

HTTPS是最容易建立,但你必須爲每一個推/拉輸入密碼(除非你想存儲你的密碼明文)

設置遠程之後,你可以用推git push origin branchname

更多信息,git的手冊上找到:http://help.github.com/remotes/

+0

謝謝Werring!我會立即嘗試。 :) – 2012-04-22 08:35:52