上傳項目到github

來源:互聯網
上載者:User

標籤:des   style   blog   http   io   ar   color   os   使用   

上傳項目到github,回憶一下過程,下次忘記了,可以look一下。

github登入。

一、

1、new respositories (建立一個倉庫)

此過程會輸入程式碼程式庫名和對程式碼程式庫的description

2、已經安裝了git工具

來到要上傳的項目下,直接右鍵,選擇“git bash”,彈出黑框。

3、接著就是初始化程式碼程式庫,就會有一個隱藏.git檔案夾,類似於.svn

git init

4、初始化項目

git add .              提交所有

git add test.txt    只提交test.txt檔案

5、提交commit

git commit

6、上傳到遠程倉庫

git remote add origin [email protected]/使用者名稱/項目名.git

7、最後一步,推送上去

git push -u origin master

init -》add-》commit-》remote-》push  五個步驟就可以把本地代碼上傳到git伺服器。

 二、安裝git工具

msysgit是Windows版的Git,從http://msysgit.github.io/下載,然後按預設選項安裝即可。

安裝完成後,在開始菜單裡找到“Git”->“Git Bash”,蹦出一個類似命令列視窗的東西,就說明Git安裝成功!

1、安裝完成後,配置使用者名稱和郵件資訊:

global表示本地上的所有程式碼程式庫都使用這個配置

安裝完成後,還需要最後一步設定,在命令列輸入:

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

2、建立ssh key

首先在本地建立ssh key。

$ ssh-keygen -t rsa -C "[email protected]"
 

[email protected]換成你的郵箱地址,輸入執行指令時會要求輸入路徑和密碼,路徑可以直接斷行符號使用預設路徑,輸入密碼時介面沒有反饋,所以你直接輸就好了,不用擔心。密碼要輸入兩次,注意不要前後不一致。

產生ssk key 後開啟預設路徑下面的id_rsa.pub檔案,複製裡面的內容。然後在你的github中進入setting

選擇ssk key

點擊 Add SSH Key

然後將複製的內容粘貼到文字框中,點擊儲存即可。

2.驗證是否成功

在git bash下使用下面的命令:

$ ssh -T [email protected]
 

運行時會要求你輸入一次yes後再輸入剛剛設定的密碼。如果最後看到:

You’ve successfully authenticated, but GitHub does not provide shell access connect to github.com closed.

說明串連是ok的。

3.設定基本資料 使用下面的命令設定你的usernameemail

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

以後每次git都會記錄nameemail

 

上傳項目到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.