git學習(九) 把本地倉庫同步到github

2021-09-29 13:48:54 字數 524 閱讀 6161

1.新建乙個遠端倉庫

我新建了乙個有以下初始化內容的git遠端倉庫

2.關聯遠端倉庫

git remote add origin ssh位址
3.檢視遠端連線情況

git remote -v
4.執行fetch命令

git fetch origin master
5.發現直接push會報錯,因為不是fast forward

6.把遠端master和本地的master合併

git merge --allow-unrelated-histories origin/master
7.push到遠端倉庫

git push origin master

把本地倉庫同步到github上去

1.愚蠢的沒有進入之前設定的工作目錄就開始用 這個命令上傳,報錯如下 fatal not a git repository or any of the parent directories git 然後看別人說用 git init 就可以了,我用了確實沒再報錯了。然後繼續用 git push u o...

git 快速使用(本地倉庫同步到遠端倉庫)

學git一段時間,可惜公司用的是svn,平時少用,又忘了,總結一下,免得下次又得重新學習。得多多用才是正道!一.將本地的提交到網上git倉庫 1.在git建立倉庫 2.在本地檔案中,輸入git init初始化,讓git接管 會多乙個檔案 千萬不能刪,刪了本地倉庫就沒了。3.用git add git ...

將本地倉庫同步到GitHub

將本地倉庫同步到githubtoc 先設定賬戶 git config global user.name yourname git config global user.email youremail 生成公鑰 一路按enter 點 add ssh key 填上任意title,在key文字框裡貼上id...