git 上傳項目到倉庫

git 上傳項目到倉庫git

 

第一步:創建倉庫!github

一、create new repository! 建立時最好選擇 init (Initialize this repository with a README  --> 自動生成README.md 文件) 二、若是未選擇 init (沒有README.md 文件,會報錯)shell

可在git 執行一下命令建立

建立 -- ① git init 
② touch README.md 
上傳 -- ③ git add README.md
④ git commit -m 'first_commit'
⑤ git remote add origin '項目地址'
⑥ git push origin master服務器

 

第二步:克隆倉庫!ssh

一、確認公鑰 -- 保持和遠程服務器創建鏈接 ① ssh -T git@github.com 正確提示 -> 【Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
  Hi findingsea! You've successfully authenticated, but GitHub does not provide shell access.】 二、clone 項目地址:https://github.com/findingsea/myRepoForBlog.git ② git clone https://github.com/findingsea/myRepoForBlog.git 成功後提示  ->   Cloning into 'myRepoForBlog'...   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.ide

第三步:上傳README.md文件(已初始化的可跳過此步驟)this

一、建立 README.md 文件 ① git init ② touch README.md ③ git add README.md ④ git commit -m 'first_commit' ⑤ git remote add origin '項目地址' ⑥ git push origin masterspa

第四步: push 文件rem

一、建立完README.md後,執行此步驟

① git add .    ② git commit -m 'first_commit'   ③ git remote add origin https://github.com/findingsea/myRepoForBlog.git   ④ git push origin masterit

二、若是執行git remote add origin https://github.com/findingsea/myRepoForBlog.git,出現錯誤:

fatal: remote origin already exists

則執行如下語句:

git remote rm origin

三、再日後執行git remote add origin https://github.com/findingsea/myRepoForBlog.git 便可。   在執行git push origin master時,報錯:

error:failed to push som refs to.......

四、則執行如下語句:

git pull origin master

五、補充 --

第四步最爲重要!!!可重複執行
① git add . ② git commit -m '註釋說明' ③ git remote add origin '項目地址' ④ git push origin master

*******************************************************

相關文章
相關標籤/搜索