<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] ## GitHubbin - 注冊GitHub帳號 ~~自己用[碼云](http://git.oschina.net/),進行實際操作,但文章依然使用了Github名稱。~~ ### 團結力量大 目前為止你建立的 repository只存在你自己的本地電腦上,雖然方便,但若想要與別人分享或合作時就顯得困難許多了。別擔心,這就是為什么我們需要GitHub! ### 步驟:建立一個GitHub 帳號 GitHub 是一個讓大家不論在哪里都可以上傳他們的Git 項目,并輕松合作的網站。 前往GitHub并注冊一個免費的帳號。 **水啦!歡迎歡迎!** ### 步驟:告訴Git 你的GitHub 帳號 告訴Git你的GitHub帳號,這個GitHub帳號將會在之后的內容中用到。注意輸入時必須與你在GitHub上建立的完全一致──**大小寫必須一致**。 告訴Git 你的GitHub 帳號: ``` $ git config --global user.username <USer_NamE> ``` ### 連接線上 Git 托管平臺 公鑰是git識別您的用戶身份的一種認證方式,通過公鑰,您可以將本地git項目與git服務器建立聯系,然后您就可以很方便的將本地代碼上傳到git服務器上,或者將git服務器上代碼下載到本地了。 >其中`~/.ssh/id_rsa`是私鑰文件,`~/.ssh/id_rsa.pub`是公鑰文件。注意私鑰文件要嚴加保護,不能泄露給任何人。 在**Mac**上打開終端輸入: ~~~ $ open ~/.ssh ~~~ 即可,打開文件夾,就可以找到`id_rsa.pub`文件了。 你可以按如下命令來生成**sshkey** : ``` ssh-keygen -t rsa -C "xxxxx@xxxxx.com" # Generating public/private rsa key pair... # 三次回車即可生成 ssh key (最好設置個好名字,如id_rsa.github和id_rsa.github.pub) ``` 查看你的public key,并把他添加到 Git @ OSC [SSH key添加地址](#) ``` cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc.... ``` 添加后,在終端(Terminal)中輸入 ``` ssh -T git@git.oschina.net ``` 若返回 ``` Welcome to Git@OSC, yourname! ``` 則證明添加成功。 ### GIT多個項目使用不同的公鑰和私鑰 前幾天遇到個情況,在github上有多個項目,在公司內部也有兩個用Git管理的項目,這幾個都要用,而 且它們的公鑰和私鑰還都不一樣,腫么辦???? 1、新建user2的SSH Key 新建SSH key: ``` $ cd ~/.ssh $ ssh-keygen -t rsa -C "mywork@email.com" ``` 新建工作的SSH key 設置名稱為id_rsa_work ``` Enter file in which to save the key (C:/Users/Administrator/.ssh/id_rsa): id_rsa_work ``` 2、新密鑰添加到SSH agent中因為默認只讀取id_rsa,為了讓SSH識別新的私鑰,需將其添加到SSH agent中: ~~~ $ ssh-add ~/.ssh/id_rsa_work ~~~ 如果出現`Could not open a connection to your authentication agent`的錯誤,就試著用以下命令: 打開ssh-agent: ``` $ ssh-agent bash ``` 添加私鑰: ``` $ ssh-add ~/.ssh/id_rsa_work ``` 3、修改config文件 在`~/.ssh`目錄下找到config文件,如果沒有就創建: ~~~ $ vim config ~~~ ---------------------------------------------- ``` # 該文件用于配置私鑰對應的服務器 # Default github user(first@mail.com) Host "github.com" HostName "github.com" User "git" IdentityFile "~/.ssh/id_rsa" # second user(second@mail.com) # 建一個github別名,新建的帳號使用這個別名做克隆和更新 Host "github2" HostName "github.com" User "git" IdentityFile "~/.ssh/id_rsa_work" ``` ---------------------------------------------- 然后測試一下: ``` $ ssh github2 ``` 如果到這里你沒有成功的話: (`ssh -vT git@github.com` **-v** 是輸出編譯信息,然后根據編譯信息自己去解決問題吧。就我自己來說一般是config里的host那塊寫錯了。) #### 補充一下 如果之前有設置全局用戶名和郵箱的話,需要`unset`一下 ``` git config --global --unset user.name git config --global --unset user.email ``` 然后在不同的倉庫下設置**局部的用戶名和郵箱** 比如在公司的repository下 ``` git config user.name "yourname" git config user.email "youremail" ``` 在自己的github的倉庫在執行剛剛的命令一遍即可。 這樣就可以在不同的倉庫,已不同的賬號登錄。 ### git不支持空目錄的提交 由于 git 在設計上就沒有考慮空文件 [Kernel.org: Git FAQ](https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F) 建議你在添加目錄的時候添加 `.keep` 之類的占位文件或者初始化`README.md`文件,空文件即可。 防止在一些開啟SVN支持的網站上,`commit`提交出現空文件錯誤!
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看