git配置教程

來源:互聯網
上載者:User

標籤:登入   帳號   glob   --   VID   com   hosts   分享圖片   出現   

一.配置ssh1.檢查本機是否有ssh key設定

如果沒有則提示: No such file or directory
如果有則進入~/.ssh路徑下(ls查看當前路徑檔案,rm刪除所有檔案)

2.使用Git Bash產生新的ssh key

$ cd ~ #保證當前路徑在”~”下

$ ssh-keygen -t rsa -C "[email protected]"  #建議填寫自己真實有效郵箱地址Generating public/private rsa key pair.Enter file in which to save the key (/c/Users/xxxx_000/.ssh/id_rsa):   #不填直接斷行符號Enter passphrase (empty for no passphrase):   #輸入密碼(可以為空白)Enter same passphrase again:   #再次確認密碼(可以為空白)Your identification has been saved in /c/Users/xxxx_000/.ssh/id_rsa.   #產生的密鑰Your public key has been saved in /c/Users/xxxx_000/.ssh/id_rsa.pub. #產生的公開金鑰The key fingerprint is:e3:51:33:xx:xx:xx:xx:xxx:61:28:83:e2:81 [email protected]//本機已完成ssh key設定,其存放路徑為:c:/Users/xxxx_000/.ssh/下。//可產生ssh key自訂名稱的密鑰,預設id_rsa。$ ssh-keygen -t rsa -C "郵箱地址" -f ~/.ssh/githug_blog_keys #產生ssh key的名稱為githug_blog_keys,慎用容易出現其它異常。
3.添加ssh key到GItHub3.1 登入GitHub系統;

點擊右上方帳號頭像的“▼”→Settings→SSH kyes→Add SSH key。

3.2 複製id_rsa.pub的公開金鑰內容

1) 進入c:/Users/xxxx_000/.ssh/目錄下,開啟id_rsa.pub檔案,全選複製公開金鑰內容。
2) Title自訂,將公開金鑰粘貼到GitHub中Add an SSH key的key輸入框,最後“AddKey”。

4.配置賬戶
$ git config --global user.name “your_username” #設定使用者名稱$ git config --global user.email “your_registered_github_Email” #設定郵箱地址(建議用註冊giuhub的郵箱)
5.測試ssh keys是否設定成功
$ ssh -T [email protected]The authenticity of host ‘github.com(192.30.252.129)‘ can‘t be established.RSA key fingerprint is16:27:xx:xx:xx:xx:xx:4d:eb:df:a6:48.Are you sure you want to continueconnecting (yes/no)? yes #確認你是否繼續聯絡,輸入yesWarning: Permanently added‘github.com,192.30.252.129‘ (RSA) to the list of known hosts.Enter passphrase for key‘/c/Users/xxxx_000/.ssh/id_rsa‘: #產生sshkye是密碼為空白則無此項,若設定有密碼則有此項且,輸入產生ssh key時設定的密碼即可。Hi xxx! You‘ve successfullyauthenticated, but GitHub does not provide shell access. #出現詞句話,說明設定成功。
二、Github建立項目1.Github建立項目2.注意項目名(必須是:github的使用者名稱.github.io)3.clone項目地址4.將項目clone到本地

然後輸入命令,斷行符號,等待clone完成。

5.將index.html推送到遠程github倉庫中
git add .git commit -m "這裡是注釋資訊,自己寫"git push origin master
寫在最後

github配置好了,就可以本地建立git項目,然後上傳到github上了。

git配置教程

聯繫我們

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