git本地倉庫關聯遠程倉庫的兩種方式

來源:互聯網
上載者:User
git本地倉庫關聯遠程倉庫的兩種方式: 1.將遠端代碼clone到本地倉庫 2.將本地的代碼關聯到遠程倉庫
1.git clone現有的項目(https | SSH) SSH: 檢查你的電腦中是否有密匙對id_rsa id_rsa.pub 沒有的話,建立密匙對  ssh-keygen -t rsa -b 4096 -C "你的git中設定的郵箱" 檢查你的ssh-agent是否是活躍的 eval "$(ssh-agent -s)" 將私匙添加到 ssh-add  ~/.ssh/id_rsa 然後將公匙複製後添加到git網站中,如github

測試是否能夠串連ssh -T git@github.com 複製到本地git clone git@github.com:hongminzhang/zhm.git
2.將本地的已有項目關聯到github上的新的項目上 在github上建立一個倉庫,然後在本地倉庫中執行git remote add origin git@github.com:stormzhang/test.git origin是倉庫的名字,可能你的本地項目關聯著幾個倉庫,你可以根據倉庫的名字 git push origin master 將代碼提交到不同倉庫中,可以指定分支 然後執行git pull origin master 先將github上的代碼pull下來 然後在git push origin master

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.