上傳本地檔案到github

來源:互聯網
上載者:User

標籤:config   建立   nts   and   git add   rsa演算法   add   not   提交   

1.配置身份

$ git config --global user.name "aaa"

$ git config --global user.email "[email protected]"

查看是否配置成功

$ git config --global user.name

$ git config --global user.email 

2.使用git建立代碼倉庫

(1)$ cd e //進入存放本地檔案的盤,此處為e盤

       $ cd java/UILayoutTest  //進入存放本地檔案的檔案夾

(2)建立倉庫

  $ git init  //會在項目的根目錄下產生一個隱藏的.git檔案夾,該檔案夾用於記錄本地所有git操作,可用$ ls -al 查看

(3)添加本地代碼到庫

   $ git add.  //.表示添加所有檔案

(4)提交

  $ git commit -m "First commit"

3.產生SSH key

(1)查看是否產生SSH key (一般都預設安裝)

  $ ssh

(2)指定rsa演算法產生密鑰

  $ ssh-keygen -t rsa  後連續三個斷行符號,在 /c/Documents and Settings/username/.ssh找到 id_rsa.pub(隱藏檔案)

(3)在github上添加SSH key

  設定--SSH and GPG keys--new SSH key--在key中粘貼id_rsa中的內容

(4)測試是否連結成功

  $ ssh -T [email protected]  //提示Hi defnngj You‘ve successfully authenticated, but GitHub does not provide shell access. 說明你串連成功了

4.上傳項目至github

(1)在github上建立一個項目

(2)將本地項目與github上的項目進行關聯

 

$ git remote add origin [email protected]:sunying225/UILayoutTest.git

(3)保證兩端代碼同步

$ git pull --rebase origin master

(4)上傳代碼

$ git push -u origin master

 

上傳本地檔案到github

聯繫我們

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