久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

GitHub的使用方法

 迷途中小小書童 2018-09-30

GitHub簡介

github是目前世界上最大的代碼存放網(wǎng)站和開源社區(qū),。我們可以利用github創(chuàng)建自己的代碼倉庫,同時訪問追蹤其他人的代碼倉庫,,還可以多人協(xié)同完成工作項目,。

使用方法總結(jié)

github有很多作用,對于常見的作用:

  • 存放代碼,,更新倉庫,;
## 上傳本地倉庫
git add filename
git commit -m 'update'
git push
#**************
## 若遠程倉庫有改動,需要先git pull, git add . 點表示加入所有變化,也可以指定具體的filename, 可以多次git add,,一次git commit
git pull
git add .
git commit -m 'update'
git push

具體使用教程

1. 下載安裝git,R,Rstudio,并注冊github賬號

這些準(zhǔn)備工作很簡單,,這里不做介紹。

2. 創(chuàng)建github資源庫(repository)

打開https://github.com/new
輸入資源庫的名字(庫的名字與本地的dir_name可以不同),,添加描述(可選擇),,設(shè)置是公開還是私秘的(私密的需要付費),勾選創(chuàng)建readme文件(這里最好勾選,,如果是空目錄的話,,本地同步github會出現(xiàn)錯誤),,創(chuàng)建。

圖1 創(chuàng)建github資源庫

3.通過Rstudio關(guān)聯(lián)本地文件和github

  • Rstudio的配置
    首先打開File,創(chuàng)建New Project, 如果路徑下沒有創(chuàng)建就選擇New diresctory,如果已經(jīng)有目標(biāo)路徑,,就選擇Existing Directory,;

    image.png

然后打開Tools,Globe Options,,Git/SVN, 選擇git安裝路徑,,同時點擊View public key, 復(fù)制;
然后打開github settings的 keys, 創(chuàng)建New SSH key, 將復(fù)制的key粘貼進去

圖3

4.本地文件夾與github關(guān)聯(lián)

打開Tools的shell窗口,,首先設(shè)置用戶名和郵箱

git config --global user.email "[email protected]" ##設(shè)置郵箱
git config --global user.name "yunxiao" ##設(shè)置用戶名

添加本地文件或文件夾

# 初始化
git init
# 添加遠程 Git 倉庫,,空白倉庫需要origin, 后面是倉庫的http或git地址
 git remote add origin https://github.com/lassefolkersen/ren-folkersen-deconvolution.git
# 提交
git commit -m 'first commit'
git push origin master

若是已知倉庫,添加更新文件

## 如果遠程倉庫有變化,,先將遠程文件拉下來,,用git pull 
git pull
git add .
## git add specific_file, .是所有文件,多次添加的文件可以一次提交
git commit -a -m "update"
## update 注釋變動的原因和內(nèi)容
git push origin master
## git push 將文件提交遠端倉庫

常見錯誤及解決辦法

git push origin master
To https://github.com/lassefolkersen/ren-folkersen-deconvolution.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/lassefolkersen/ren-folkersen-deconvolution.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git pull origin master
git push -u origin master -f

其他常見操作

刪除倉庫或文件夾

刪除倉庫從settings下刪除,刪除文件從命令行即可
git remote rm test

恢復(fù)歷史版本

#查詢顯示
git reflog
10e2ff3 (HEAD -> master, origin/master) HEAD@{0}: reset: moving to 10e2
10e2ff3 (HEAD -> master, origin/master) HEAD@{1}: commit (initial): add folder
#恢復(fù)
$ git reset --hard 10e2
HEAD is now at 10e2ff3 add folder

git 學(xué)習(xí)資源

廖雪峰git教程

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多