Centos配置github
生活随笔
收集整理的這篇文章主要介紹了
Centos配置github
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1. 首先確保安裝了git:
git --version2. 如果沒有安裝,使用下述命令進(jìn)行安裝,若安裝了則跳過2:
yum install git3. 配置git:
# 配置,郵箱盡量填寫你的github注冊郵箱 git config --global user.name “your name” git config --global user.email "your_email@example.com"# 檢查配置 git config --list4. 進(jìn)入目錄~/.ssh下,執(zhí)行下面腳本一路Enter生成ssh密鑰和公鑰:
cd ~/.ssh# 郵箱盡量填寫你的github注冊郵箱 ssh-keygen -t ecdsa -b 521 -C "your_email@example.com"此時該目錄下生成兩個文件:id_ecdsa和id_ecdsa.pub,打開id_ecdsa.pub,復(fù)制內(nèi)容,
cd ~/.sshvi id_ecdsa.pub# 內(nèi)容類似下面 ecdsa-sha2-nistp521 AAAAE2VjZHNhLXN********1MjEAAAAIbmlzdHA1MjEAAACFBAAptVsQ1Pfj1XfaCRmbHZNI+xfr/L1QXvrBwvGEjYIvmlfjns0YAYGy7GCRlshctz3peRbW1ID4OS7YSKB+516W/ABztfJiHGHfkWxqtr8HBymUXC4epbKC4PaLsNhTLM690Q3ftRuFv1cFssYXPXuIIVFtA1z8J4IA0axNO/uUB4pHgg== your_email@example.com5. 打開github登陸,找到如下位置:
順序:
? ? ? ? 5.1.點頭像找settings;
? ? ? ? 5.2.左側(cè)菜單欄找到 SSH and GPG keys;
? ? ? ? 5.3.點擊右上角New SSH key粘貼剛才復(fù)制的公鑰內(nèi)容,命名隨意哈。
6. 輸入以下腳本測試key,,看能否登陸github.
ssh -T git@github.com7. 看到下面提示,輸入yes即可;
The authenticity of host 'github.com (207.97.227.239)' can't be established.RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.Are you sure you want to continue connecting (yes/no)?8. 成功后回顯示
Hi xxxxx! You've successfully authenticated, but GitHub does notprovide shell access.注意:這里通過ssh配置,因此git配置遠(yuǎn)程倉庫使用ssh型的:
# 基本操作# 初始化git git init# 本地添加暫存 git add .# 提交到本地倉庫 git commit -m 'first commit'# 添加遠(yuǎn)程倉庫 git remote add origin git@github.com:yourname/xxxxx.git# 提交到遠(yuǎn)程github倉庫 git push origin branch_name參考:About SSH - GitHub Docs
總結(jié)
以上是生活随笔為你收集整理的Centos配置github的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SQL Server 【不允许保存更改】
- 下一篇: s7200cpu224xp手册_西门子S