栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Git提交代码操作-踩坑解决

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Git提交代码操作-踩坑解决

git 提交代码操作-踩坑解决 一、第一次提交

克隆或者下载项目,解压

进入项目文件夹,打开cmd

# 第一次
git init
git branch -M master
git remote add origin git@gitee.com:User/project.git

# 提交代码到本地git缓存区
git add .
# 推送代码到本地git库
git commit -m “描述信息”
# 推送到云端仓库,先下拉云端的,与本地的进行合并,再推上去
git pull origin master
git push -u origin master 
二、后续提交
# 后续代码提交
# 提交代码到本地git缓存区
git add .
# 推送代码到本地git库
git commit -m “描述信息”
# 推送到云端仓库,先下拉云端的,与本地的进行合并,再推上去
git pull origin master
git push -u origin master 
三、出现问题 1、问题一 (1)报错:

git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.

C:Users荔枝Desktopproject>git push -u origin master
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

C:Users荔枝Desktopproject>git pull origin master
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.
(2)解决:

https://blog.csdn.net/dl962454/article/details/121944997

在步骤3出现问题

2、问题二 (1)问题:

在上述链接步骤3出现问题,公钥报错。

教程步骤:

我的问题:

(2)解决:

进入C:Users用户名.ssh文件目录,打开cmd

输入clip < id_rsa.pub,自动复制公钥在剪贴板,重新粘贴。无错误。

3、问题三 (1)报错:
error: failed to push some refs to 'gitee.com:user/project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

(2)原因:

直接进行了推送。

(3)解决:

重新输入以下内容:

git branch -M master
git remote add origin git@gitee.com:User/project.git
git add .
git commit -m “描述信息”
git pull origin master
git push -u origin master 
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/853833.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号