1. 程式人生 > >上傳程式碼到碼雲 簡單方法以及坑

上傳程式碼到碼雲 簡單方法以及坑

以下所有操作都在命令列進行

 

1 git 配置

git config --global user.name “使用者名稱”

git config --global user.email “郵箱”

2 生成公鑰私鑰

	#ssh-keygen -t rsa -C "[email protected]"

一路Enter下去,將生成的公鑰填在碼雲上

	#cat ~/.ssh/id_rsa.pub

3建立git倉庫

在你的專案資料夾下執行git命令

git init

4 將專案檔案新增到倉庫中

git add .

5 將add的檔案commit到倉庫

git commit -m '備註'

6 將本地倉庫關聯到碼雲上

git remote add origin [email protected]:shiqingqing/test.git

7 上傳碼雲前要先pull 下

git pull origin  master

8  最後一步 上傳程式碼到碼雲倉庫

git push -u origin master

執行完後到碼雲看你專案的程式碼

如出現錯誤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 push -u origin master -f  強制命令會覆蓋別人分支,慎用

轉發地址:https://blog.csdn.net/qq_36434647/article/details/78731931

https://blog.csdn.net/qq_28112913/article/details/79744324

GitHub地址:https://github.com/HuaDanJson