美文网首页
GIT 提交项目

GIT 提交项目

作者: 小迷糊紫靈 | 来源:发表于2019-10-01 20:08 被阅读0次

一、初始化项目

在项目中初始化git仓库

git init

初始化后会自动创建.git的文件夹,.git文件夹为本地仓库。

$ git init
Initialized empty Git repository in 项目路径/.git/

到此已经初git本地仓库已经创建成功。

二、关联远程仓库

git remote add origin 项目地址

三、提交文件到本地仓库

git add .

提交时会显示所需要提交的文件

$ git add .
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in my-utils/pom.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pom.xml.
The file will have its original line endings in your working directory

后面的“.”标识当前目录的所有文件提交。

四、创建提交备注信息

git commit -m “备注信息”
$ git commit -m '初始化提交'
[master (root-commit) fc03ad2] 初始化提交
 9 files changed, 168 insertions(+)
 create mode 100644 .idea/compiler.xml
 create mode 100644 .idea/misc.xml
 create mode 100644 .idea/workspace.xml
 create mode 100644 my-tools.iml
 create mode 100644 my-utils/my-util-exception/pom.xml
 create mode 100644 my-utils/my-util-exception/src/main/java/pers/yiming/App.java
 create mode 100644 my-utils/my-util-exception/src/test/java/pers/yiming/AppTest.java
 create mode 100644 my-utils/pom.xml
 create mode 100644 pom.xml

五、强制提交

在提交的时候加上-f会强制提交当前版本到远程仓库

git push -u origin master -f

六、输入电子邮件和名称

git config user.email “email”
git config user.name “username”

六、异常

当已经使用过git的时候,会提示无法提交的情况。

$ git push -u origin master -f
remote: You do not have permission to push to the repository via HTTPS
fatal: Authentication failed for '项目地址'

解决办法:
在控制面板中搜索凭据,找到windows凭据修改对应的账号密码即可。

相关文章

  • Git 提交代码到远程分支

    环境:windows 提交方式:Git Bash 命令行提交 1.进入需要提交的项目Git目录右键选择Git Ba...

  • Git常用代码

    Git常用 git提交项目 git init 在项目中打入.git文件 git add src 添加文件夹 g...

  • GIT 常用命令随笔

    常用git 命令 git 代码回滚 先显示提交的log 回滚到指定的版本 强制提交 git 新建项目 git 修改...

  • GIT 统计 绩效 KPI 使用

    项目提交者 时间范围内 提交 代码量 项目提交者 时间范围内 提交数 项目总行数 项目提交总数 参考:GIT统计代...

  • git常用命令

    一,克隆项目到本地 git clone + 项目地址 二,更新项目 git pull 三,提交文件 git com...

  • GIT 提交项目

    一、初始化项目 在项目中初始化git仓库 初始化后会自动创建.git的文件夹,.git文件夹为本地仓库。 到此已经...

  • git常用命令,个人笔记

    项目开发中,管理代码 1.提交代码 git add . //提交所有文件 git commit -m "此处...

  • GIT简单使用

    本地配置全局git 创建本地仓库提交到git上 该针对本地没有存在的项目。 提交本地已存在的项目到git 针对本地...

  • git 命令的简单使用

    1、 git 拉项目 2、 git 回滚项目 3、 git 提交到分支 4、 git 切换分支 5、合并分支 将分...

  • 代码管理工具git 常用命令

    远程拉取项目:git clone 地址 状态:git status 添加:git add . 提交:git com...

网友评论

      本文标题:GIT 提交项目

      本文链接:https://www.haomeiwen.com/subject/gpzkpctx.html