天天看點

git送出代碼到遠端倉庫 github

1 如果是第一次使用github 先配置一下ssh key

第一步 在指令行中輸入ssh-keygen -t rsa -C “你的郵箱”

預設會在 /C/Users/Administrator/.ssh/id_rsa 生成三個檔案

把字尾名為.pub 用記事本打開 複制粘貼到github ->Settings->SSH and GPG keys->SSH keys

git config --global user.name “linguanyu1” //配置使用者名 github 的使用者名

git config --global user.email “[email protected]” //配置郵箱,注冊github用的郵箱

git init // 初始化檔案

git add test.css // 要添加到github上的檔案

git status //檢視狀态,待添加狀态顯示為綠色

git commit -m “第一次送出” // 送出說明,可寫可不寫

git remote add origin [email protected]:linguanyu1/demo.git //如果已經配置ssh 此方式送出不用密碼

git remote add origin https://https://github.com/linguanyu1/demo.git

// 将本地的倉庫關聯到github上

git pull --rebase origin master // 把github上的檔案克隆到目前檔案夾,這一步的原因是

預防報類似failed to push some refs to…的錯誤

git push -u origin master // 送出

1 把首頁面命名成index.html

2 倉庫名為使用者名加.github.io (後期通過這個連結通路你的首頁)