如何將本地開發的項目提交到碼雲?

一、本地安裝git環境
下載安裝包安裝便可
二、初始化git項目,生成 .git 配置目錄
進入項目根目錄,右鍵 git bash here打開控制檯 ,輸入git init便可完成
三、將項目加入本地git倉庫
git add . (此處add後面有空格 和點號)
git status
touch README.md (可不要
git add README.md (可不要
git commit -m "first commit"
四、在git、碼雲建好雲端項目,生成git url
建好項目,在項目的克隆下載處複製url便可
五、鏈接雲端倉庫,將本地倉庫代碼提交到雲端倉庫
鏈接雲端倉庫
git remote add origin https://gitee.com/xxx/xxx.git
爲解決本地與雲端版本衝突,加上-f參數,push文件
git push --set-upstream origin master -f
以後會提示輸入雲端倉庫的用戶名,密碼,驗證成功開始上傳並完成,實測碼雲可經過
不加f會提示錯誤:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/xxx/xxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.git


到此就完成了目的。
之後每次提交是先提交到本地倉庫,
需從新運行 git push --set-upstream origin master -f
更新到雲端
或是commit 後 push
push
git 修改用戶名,郵箱:
當前 project:
直接修改 .git目錄下 config文件的
[user]
name =xxx
email = xxx

git config user.name 用戶名;
git config user.email 郵箱;
全局:
git config  --global user.name 用戶名;
git config  --global user.email 郵箱名;bash

---------------------
做者:風狂的學者
來源:CSDN
原文:https://blog.csdn.net/suifeng2018/article/details/79160990
版權聲明:本文爲博主原創文章,轉載請附上博文連接!ui

相關文章
相關標籤/搜索