1.github/gitee 建立賬号并建立任務倉庫
2.進入倉庫 複制下code裡面的位址 等會兒要用
3.到本地項目檔案夾右鍵選擇git bash here
4.輸入個人資訊(代碼送出者)
使用者名即為你點選自己頭像之後下面的那串字母+數字
git config --global user.email “[email protected]”
(碼雲密碼輸入錯誤的話{有時候隻能輸錯一次} 你需要進入“憑據管理器”修改密碼(工作列搜尋“憑據管理器”))
5.在本地項目目錄建立本地倉庫
git init
輸入指令後項目目錄會有一個隐藏的.git檔案夾
6.上傳所有代碼到本地倉庫
git add . (注意add後面有個點,與add之間有一空格)
7.這樣就把代碼上傳到本地倉庫了
(引号裡面是你本次改動的備注,内容随意)
8.關聯本地倉庫并上傳代碼
git remote add origin (https://github.com/Yanyf765/hr_sys.git)
(2步驟複制的位址)
9.(分割)
git push origin master
(推送你的代碼到遠端伺服器端)
報錯:(此時報錯是正常的 需要先将之前的代碼拉取下來 再進行推送)
!!!注意拉取之後 需要重複6-7步驟将代碼儲存到本地倉庫 并且處理掉檔案内的沖突 沖突主要來源于服務端檔案和本地檔案的不同 需要你選擇保留本地目前更改還是伺服器端傳入的更改
10.執行指令:
git pull origin master --allow-unrelated-histories
git 在pull或者合并分支的時候有時會遇到這個界面。可以不管(直接下面3,4步),如果要輸入解釋的話就需要:
1.按鍵盤字母 i 進入insert模式
2.修改最上面那行黃色合并資訊,可以不修改
3.按鍵盤左上角"Esc"
4.輸入":wq",注意是冒号+wq,按Enter鍵即可
之後就可以成功的pull,push了
送出到遠端報錯,如下:
src refspec master does not match any
原因:
本地倉庫為空
解決方法:使用如下指令 添加檔案;
$ git add add.php addok.php conn.php del.php edit.php editok.php ftpsql.sql index.php
之後在push過程中出現如下錯誤:
$ git push -u origin master
Warning: Permanently added the RSA host key for IP address 'xx.xx.xxx.xxx' to the list of known hosts.
To [email protected]:hahaha/ftpmanage.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to '[email protected]:hahahah/ftpmanage.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 之後在 push
使用如下指令解決:
$ git pull --rebase origin master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:hahah/ftpmanage
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
First, rewinding head to replay your work on top of it...
Applying: init files
繼續push,成功。
這是我從網上搜集的一些使用流程和一些問題的解決方法
有問題 歡迎大家留言提問!!!
補充 碼雲 Gitee 如果需要每次都輸入賬号密碼的話 估計是你的憑據管理器沒有儲存你的碼雲賬号密碼
在你的計算機搜尋憑據管理器
位址輸入:https://gitee.com/
使用者名和密碼即為你的賬号密碼
此時應該就不需要每次送出的時候輸入賬号密碼