天天看點

GIT送出項目到遠端倉庫

Hello,everyone!

我是魯班·,一個熱衷于科研和軟開的胖子!

#一、GIT的下載下傳及安裝

####1.打開百度,在搜尋框輸入“GIT下載下傳”,出現此界面:

GIT送出項目到遠端倉庫

選擇第一條點選進入,網址:https://git-scm.com/downloads

####2.下載下傳GIT

進入頁面後選擇此項,如下圖所示:

GIT送出項目到遠端倉庫
GIT送出項目到遠端倉庫

####3.安裝GIT

安裝教程網址:https://jingyan.baidu.com/article/7f766dafba84f04101e1d0b0.html

#二、使用GIT送出項目到遠端倉庫

####1.標明某磁盤,建立檔案夾。以E:\GITest為例。在此檔案夾下右鍵滑鼠,單擊“GIT Bash Here”,出現此界面。

GIT送出項目到遠端倉庫

####2.使用Git config配置變量。

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
           
GIT送出項目到遠端倉庫

####3.建立版本庫

使用

git init

指令建立版本庫。

GIT送出項目到遠端倉庫

此時指定的檔案夾裡出現.git檔案夾。

4.添加項目到指定的檔案夾下,建立檔案夾Test,裡面有一個readme.txt,如下圖所示:

GIT送出項目到遠端倉庫

####5.送出檔案到遠端倉庫。指令如下:

//連接配接遠端倉庫
$ git remote add origin https://[email protected]:6051/r/WebFramework/2017/team7.git
//解決在push過程中遇到的證書問題
$ git config --global http.sslVerify false
//輸入此指令擷取所有遠端分支,此時會輸入密碼,我會單獨發到微信群裡
$ git pull
warning: no common commits
remote: Counting objects: 20, done
remote: Finding sources: 100% (20/20)
remote: Getting sizes: 100% (13/13)
remote: Total 20 (delta 0), reused 20 (delta 0)
Unpacking objects: 100% (20/20), done.
From https://183.175.14.209:6051/r/WebFramework/2017/team7
 * [new branch]      changzehui   -> origin/changzehui
 * [new branch]      haolifei     -> origin/haolifei
 * [new branch]      heyu         -> origin/heyu
 * [new branch]      houbocheng   -> origin/houbocheng
 * [new branch]      litingting   -> origin/litingting
 * [new branch]      liuyingcong  -> origin/liuyingcong
 * [new branch]      master       -> origin/master
 * [new branch]      xuhaotian    -> origin/xuhaotian
 * [new branch]      yangrunze    -> origin/yangrunze
 * [new branch]      yuchang      -> origin/yuchang
 * [new branch]      zhangwenjing -> origin/zhangwenjing
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
//下一步,輸入轉換分支的指令,我已經為大家建立好了分支,如上述第二列所示,checkout後面寫的就是分支名稱。
$ git checkout yangrunze
Switched to a new branch 'yangrunze'
Branch yangrunze set up to track remote branch yangrunze from origin.
//然後做一個push動作。
$ git push -u origin yangrunze
Everything up-to-date
Branch yangrunze set up to track remote branch yangrunze from origin.
//添加Test檔案夾
$ git add Test
//送出 -m後寫的是本次送出的說明
$ git commit -m "readme.txt"
//然後做一個push動作。
$ git push -u origin yangrunze
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 352 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Updating references: 100% (1/1)
To https://183.175.14.209:6051/r/WebFramework/2017/team7.git
   fbb495a..0a8411a  yangrunze -> yangrunze
Branch yangrunze set up to track remote branch yangrunze from origin.

           

至此,檔案上傳完成。

然後登陸https://183.175.14.209:6051檢視送出結果即可。

結果如下圖:

GIT送出項目到遠端倉庫
内容靠得住,關注不迷路。
GIT送出項目到遠端倉庫