南强小屋 Design By 杰米

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

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

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

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

git config --global user.name "xxxx" 

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

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

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

 git init  

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

上传所有代码到本地仓库

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

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

 git commit -m "initial commit"

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

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

关联本地仓库并上传代码

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

git push origin master

报错:

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

执行命令:

git pull origin master --allow-unrelated-histories

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

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

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

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

3.按键盘左上角"Esc"

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

之后就可以成功的pull,push了

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

提交到远程报错,如下:

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

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,成功。

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

总结

标签:
Git建立本地仓库,Git建立本地仓库上传Gitee

南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米

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

暂无Git建立本地仓库并上传到Gitee的详细步骤的评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。