github也是初次接觸,還需要多多使用早日熟悉绍在。
初次上傳文件到github
1.建立倉庫什么的就不說了。
2.clone倉庫:
git clone https://github.com/liuweigg/liuweigg.github.io.git
clone成功如下:
Cloning into 'liuweigg.github.io'...
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
這一段我沒截上歹垫,網(wǎng)上隨便找了這么一段桑滩,大概是個意思梧疲。
3.push文件:
git add .
git commit -m 'first_commit'
git remote add origin https://github.com/liuweigg/liuweigg.github.io.git
git push origin master
如果執(zhí)行g(shù)it remote add origin https://github.com/liuweigg/liuweigg.github.io.git,出現(xiàn)錯誤:
fatal: remote origin already exists
則執(zhí)行以下語句:
git remote rm origin
再往后執(zhí)行g(shù)it remote add origin https://github.com/liuweigg/liuweigg.github.io.git 即可施符。
在執(zhí)行g(shù)it push origin master時往声,報錯:
error:failed to push som refs to.......
則執(zhí)行以下語句:
git pull origin master
先把遠(yuǎn)程服務(wù)器github上面的文件拉先來,再push 上去戳吝。