GIT提交项目到远程仓库

一、GIT的下载及安装

1.打开百度,在搜索框输入“GIT下载”,出现此界面:

选择第一条点击进入
选择第一条点击进入,网址:https://git-scm.com/downloads

2.下载GIT

进入页面后选择此项,如下图所示:
这里写图片描述
这里写图片描述

3.安装GIT

安装教程网址:https://jingyan.baidu.com/article/7f766dafba84f04101e1d0b0.html

二、使用GIT提交项目到远程仓库

1.选定某磁盘,新建文件夹。以E:\GITest为例。在此文件夹下右键鼠标,单击“GIT Bash Here”,出现此界面。

这里写图片描述

2.使用Git config配置变量。

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

这里写图片描述

3.创建版本库

使用git init 命令创建版本库。
这里写图片描述
此时指定的文件夹里出现.git文件夹。

4.添加项目到指定的文件夹下,新建文件夹Test,里面有一个readme.txt,如下图所示:

这里写图片描述

5.提交文件到远程仓库。命令如下:

//连接远程仓库
$ git remote add origin https://team7@183.175.14.209: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查看提交结果即可。
结果如下图:
这里写图片描述

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页