github 入門

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   檔案   

1 註冊github 帳號後登陸。

2 建立一個新的項目 , 點擊Github 首頁的右下角 ”New repository“ 按鈕

填寫你的項目名和項目的描述,點擊”Create repository“ 按鈕建立

3 給github 配置ssh 信任關係。

Linux 環境要先產生 公開金鑰和秘鑰

ssh-keygen 

一直斷行符號就可以了,它會在目前使用者的HOME 目錄下產生 .ssh 目錄

cat  /root/.ssh/id_rsa.pub

cat 一下公開金鑰 ,將公開金鑰資訊儲存在github 的ssh 管理當中

Github 首頁,點擊 右邊的 “Account settting” 按鈕

點擊左手邊的 ”SSH keys“

點擊”Add SSH key”

Title 隨便寫一個就好了,Key 就是剛才的公開金鑰資訊,填寫好了,點擊“Add key”

測試能否和Github 連通

ssh –T [email protected]

在Linux 上建立和一個檔案夾存放 Github的檔案

mkdir -p /opt/githubcd /opt/github

4 安裝git ,安裝方法參考github 官網介紹

http://git-scm.com/download/linux

配置 Github 帳號

git config --global user.name "使用者名稱"git config --global user.email github註冊的郵箱地址

5 初始化github 配置

git init

6 git 操作

串連一個github 項目

git remote add origin https://github.com/chenfool/test.git

 

新增一個檔案,並且提交給Github

echo "hello github" > /opt/github/test.txt
git add /opt/github/test.txt
git commit /opt/github/test.txt -m "this is a test"
git push origin master

再到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.