电脑安装git客户端、注册github账号并登陆

到本地项目文件夹右键选择git bash here

输入个人信息(代码提交者)

git config --global user.name "xxxx"

git config --global user.email xxxxx@qq.com

在本地项目目录创建本地仓库

git init

输入命令后项目目录会有一个隐藏的.git文件夹

上传所有代码到本地仓库

git add.   (注意add后面有个点,与add之间有一空格)

这样就把代码上传到本地仓库了

git commit -m "initial commit"

it

在gitee上新建项目,复制https://gitee.com/xxx/xx.git地址

关联本地仓库并上传代码

git remote add origin https://github.com/Yanyf765/hr_sys.git(上步骤复制的地址)

git push origin master

报错:

执行命令:

git pull origin master --allow-unrelated-histories

git 在pull或者合并分支的时候有时会遇到这个界面。可以不管(直接下面3,4步),如果要输入解释的话就需要:

1.按键盘字母 i 进入insert模式

2.修改最上面那行黄色合并信息,可以不修改

3.按键盘左上角"Esc"

4.输入":wq",注意是冒号+wq,按回车键即可

之后就可以成功的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

$ git commit -m "init files"

之后在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 git@github.com:hahaha/ftpmanage.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com: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,成功。

  路劲  :https://blog.csdn.net/sclibingqing/article/details/81179470

git 上传项目到远程仓库的更多相关文章

  1. 使用Git上传项目到GitHub仓库

    GitHub账号注册很长时间了,但是没怎么上传过东西.今天学习如何利用Git工具将代码上传到GitHub,了解了一些常用命令 $ git config --global user.name " ...

  2. Git——新手入门与上传项目到远程仓库GitHub

    Git:先进的分布式版本控制系统,一个开源式的分布式版本控制工具. Git安装 在Windows操作系统下,访问Git下载地址https://git-for-windows.github.io/ 注册 ...

  3. 使用Git上传代码到远程仓库

    1.进入文件夹,cd f:/test/ 2.初始化远程仓库,git init 3.添加代码,git add . (注意add后面的点前面有一个空格) 4.提交代码到远程仓库,git commit -m ...

  4. git 上传本地代码到远程仓库

    未经允许,禁止转载! 查看哪些文件被修改过:git status 查看具体的修改内容:git diff 对新添加的文件进行添加:git add 文件名 提交修改标记:git commit -m &qu ...

  5. Git——新手入门与上传项目到远程仓库GitHub(转)

    Git概述 什么是Git? 刚开始对这个东西也感到挺迷茫,并且问了好多已经学习android一段时间的同学也是一头雾水,直到了解并使用之后,才体会到Git的好处以及重要意义. Git:是目前世界上最先 ...

  6. git 上传项目到仓库

    git 上传项目到仓库 第一步:建立仓库! 1.create new repository! 创建时最好选择 init (Initialize this repository with a READM ...

  7. IDEA新项目代码上传到gitlab远程仓库

    IDEA新项目代码上传到gitlab远程仓库 具体步骤 创建本地仓库 IDEA:VCS-->Import into Version Control-->Create Git Reposit ...

  8. 使用git上传项目到GitHub上

    之前的博客有<使用git拉取GitHub上的项目>的文章,那么现在说一下,如何上传项目到GitHub上. 1. Git的.gitignore 文档配置 因为项目中可能有很多的图片还有nod ...

  9. GitHub上传项目到远程库

    写文章 GitHub上传项目到远程库     GitHub上传项目到远程库 今天把想把文件托管到GitHub仓库,但是执行一系列的命令以后,刷新GitHub网站还是没有任何更新.后来终于找到原因,原来 ...

随机推荐

  1. 全网最详细的ReentrantReadWriteLock源码剖析(万字长文)

    碎碎念) 花了两天时间,终于把ReentrantReadWriteLock(读写锁)解析做完了.之前钻研过AQS(AbstractQueuedSynchronizer)的源码,弄懂读写锁也没有想象中那 ...

  2. keybd_event模拟键盘按键,mouse_event怎么用

    从 模仿UP主,用Python实现一个弹幕控制的直播间! - 蛮三刀酱 - 博客园 (cnblogs.com) 知道了 PyAutoGUI: * Moving the mouse and clicki ...

  3. InnoDB学习(二)之ChangeBuffer

    ChangeBuffer是InnoDB缓存区的一种特殊的数据结构,当用户执行SQL对非唯一索引进行更改时,如果索引对应的数据页不在缓存中时,InnoDB不会直接加载磁盘数据到缓存数据页中,而是缓存对这 ...

  4. PLSQL导出oracle表结构和数据

    1.导出表结构和数据 方式1.tools->export user objects是导出表结构 tools ->export user object 选择选项,导出.sql文件 说明:导出 ...

  5. 转 序列化Serializable和Parcelable的区别详解

    什么是序列化,为什么要进行序列化 答:对象要进行传输(如:activity 与activity间 ,网络间 进程间等等).存储到本地就必须进行序列化 . 这种可传输的状态就是序列化. 怎么序列化??两 ...

  6. 应用springMVC时如果配置URL映射时如下配置

    应用springMVC时如果配置URL映射时如下配置 [html] view plaincopy<servlet> <servlet-name>appServlet</s ...

  7. html href页面跳转获取参数

    //传递参数 var id = columnData.id; var companyname = encodeURI(columnData.companyname); var linename = e ...

  8. SVN终端演练-版本回退

    1. 版本回退概念以及原因?    概念: 是指将代码(本地代码或者服务器代码), 回退到之前记录的某一特定版本    原因: 如果代码做错了, 想返回之前某个状态重做;2. 修改了,但未提交的情况下 ...

  9. AOP中环绕通知的书写和配置

    package com.hope.utils;import org.aspectj.lang.ProceedingJoinPoint;import org.aspectj.lang.annotatio ...

  10. 从orderby引发的SQL注入问题的思考

    背景: 某一天准备上线,合完master之后准备发布了,忽然公司的代码安全监测提示了可能在代码中存在sql注入的风险,遂即检查,发现sql注入问题 既然碰到了这个问题,那就了简单了解下sql注入 基础 ...