首页前端开发其他前端知识Git建立本地仓库并上传到Gitee的详细步骤

Git建立本地仓库并上传到Gitee的详细步骤

时间2024-02-10 21:42:02发布访客分类其他前端知识浏览1031
导读:收集整理的这篇文章主要介绍了Git建立本地仓库并上传到Gitee的详细步骤,觉得挺不错的,现在分享给大家,也给大家做个参考。 电脑安装gIT客户端、注册github账号并登陆到本地项目文...
收集整理的这篇文章主要介绍了Git建立本地仓库并上传到Gitee的详细步骤,觉得挺不错的,现在分享给大家,也给大家做个参考。

电脑安装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 masterwarning: no common commitsremote: Counting objects: 3, done.remote: total 3 (delta 0), reused 0 (delta 0), pack-reused 0Unpacking objects: 100% (3/3), done.From github.com:hahah/ftpmanage * branch  master ->
     FETCH_HEAD * [new branch] master ->
     origin/masterFirst, rewinding head to replay your work on top of it...Applying: init files

继续push,成功。

总结

到此这篇关于Git建立本地仓库并上传到Gitee的文章就介绍到这了,更多相关Git建立本地仓库内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

您可能感兴趣的文章:
  • 解决Unable to access ''https://gitee.com/自己的项目/'': Could not resolve host: gitee.com问题
  • Gitee的下载安装配置及使用步骤详解
  • 微信小程序使用gitee进行版本管理
  • Python自动化运维和部署项目工具Fabric使用实例
  • Python自动化部署工具Fabric的简单上手指南
  • Python的自动化部署模块Fabric的安装及使用指南
  • 使用Gitee自动化部署python脚本的详细过程

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: Git建立本地仓库并上传到Gitee的详细步骤
本文地址: https://pptw.com/jishu/608913.html
关于target目录在idea没显示的问题 解决idea打开窗口/tab过多导致隐藏的问题

游客 回复需填写必要信息