使用SourceTree往GitHub 上管理代碼


用SourceTree這個工具實現了上傳項目。

     首先, 
         1 :需要去sourceTree官網(https://www.sourcetreeapp.com)下載安裝包,當然了如果你現在用的就是,那就剩下了很多功夫了,
         2 :然后是注冊GitHub賬號,https://github.com/ -->Pricing and Signup -->Create a free account
        3: 接下來是創建 SSh;
    在local打開terminal:
       $cd ~/.ssh  檢查是否已經存在ssh
       如果存在,先將已有的ssh備份,或者將新建的ssh生成到另外的目錄下
       如果不存在,通過默認的參數直接生成ssh
       生成過程如下:
       ssh-keygen -t rsa -C xxxxx@gmail.com(注冊github時的email)
        Generating public/private rsa key pair.
         Enter file in which to save the key (/Users/twer/.ssh/id_rsa): (見一個文件存放就行)
        Created directory '/Users/twer/.ssh'.
        Enter passphrase (empty for no passphrase): 
        Enter same passphrase again: 
        Your identification has been saved in /Users/twer/.ssh/id_rsa.
        Your public key has been saved in /Users/twer/.ssh/id_rsa.pub.
        The key fingerprint is:
        18:16:11:c9:01:6c:48:09:7f:27:c6:43:0d:7f:3f:84 xxxxx@gmail.com
        The key's randomart image is:
        +--[ RSA 2048]----+
        |.o.++===         |
        |.ooo.+. .       |
        |  ..* = E .      |
        |   o = + o       |
        |      . S o      |
        |           .     |
        |                 |
        |                 |
        |                 |
       +-----------------+
       如果要修改ssh生成目錄,在藍色位置處輸入要生成的路徑,選擇默認的話,會生成在 ~/.ssh下
    <<18:16:11:c9:01:6c:48:09:7f:27:c6:43:0d:7f:3f:84 xxxxx@gmail.com>>這個就是生成的key 
       4:  在github中添加ssh(如圖示)
       登陸github,選擇Account Settings-->SSH  Keys 添加ssh
       Title:xxxxx@gmail.com
       Key:打開你生成的id_rsa.pub文件,將其中內容拷貝至此。
       打開終端,先測試一下你的帳號跟github連上沒有:ssh -T git@github.com 如果出現如下提示,表示你連已經連上了.(因為有了第一步,所以不用自己做過多的連接github的操作了,另外,下一次要連接github的時候記得打開第一步的工具).
      等你的鑰匙顯示這個綠色的圖標就就是你成功了
    5:  接下來就可以上傳你的代碼了,在github下建自己的Repository。Create a New Repository如下:

 

  • Repository name:通常就寫自己自己要建的工程名。
  • Description:就是你對工程的描述了。
  • 選擇Public。
  • 點擊 “Create repository”,出現如下圖:

    復制這個網址,打開sourceTree

 生成如下在界面,在SourceTree中打開如下界

點擊Clone 如圖說明克隆成

 

點擊 show in finder 后把我們創建的項目復制進去(是復制里邊的所有文件)如圖



 

  接下來打開sourceTree 如圖

按順序點擊1-2-3  出現下圖  圓圈是填寫這次修改了哪些東西  之后點擊右下角commit

    點擊后 上面推送按鈕  然后點擊OK就可以輕松的把項目上傳到github了  。

       打開github后查看如下圖片就說明成功了  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM