git上传详细步骤和提交代码的各种报错解决方式. |
您所在的位置:网站首页 › 文件一直上传失败怎么回事 › git上传详细步骤和提交代码的各种报错解决方式. |
git输入指令:如下 1.git log 查看git合入的记录 git log2.git pull从服务器重新拉代码,将本地代码更新为服务器上的最新代码 git pull3.git status查看本地代码状态,是否有待提交的代码 git status4.git add . 将本地代码全部提交 git add .5.git commit -m “合入新的PUCCH和小区功率代码” 为本次提交添加注释 git commit -m 备注信息6.git push origin 分支名 git push origin master7.git branch -a 查看远程所有分支 git branch -al 或git branch -a8.git checkout 分支名 git checkout 要切换的分支名9.git remote 连接远程仓库 git remote add origin 远程地址10.初始仓库 git init11.git 合并分支 git merge 分支名12.clone项目分支 git clone 分支名 远程仓库地址 git clone -b devlop https://....git二.拉取远程分支到本地详细步骤:如下 1.创建文件夹 (放置) 2.初始化(生成.git文件) git init3.本地与远程建立连接 git remote add origin 远程链接(例如:https://www.baidu.com.git)4.把远程分支拉取到本地(master/devlop/…) git fetch origin master(分支名)5.git checkout -b devlop(本地分支名称) origin/wat_master(远程分支名称) git checkout -b devlop origin/wat_master6.把远程分支上的内容都拉取到本地 git pull origin wat_master(分支名)本地已经copy完成项目 三.git 分支合并到master步骤: 项目在分支上,正常提交 1.提交本地所有文件夹 git add .2.提交备注信息 git commit -m '提交的备注信息'3.提交到分支 git push -u origin devlop4.切换到master分支 git checkout master补充:如果需要查看所有分支:git branch -a 5.多人协助开发的master/需要先pull一下代码(这里是将本地代码更新为服务器上的最新代码) git pull origin master //如果是自己一个开发就没有必要了,为了保险期间还是pull补充:如果有冲突就要先解决冲突、 6.然后我们把分支的代码合并到master上 git merge devlop7.然后查看状态及执行提交命令 git status On branch master Your branch is ahead of 'origin/master' by 12 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean //上面的意思就是你有12个commit,需要push到远程master上 > 最后执行下面提交命令 git push origin master8.其他命令 更新远程分支列表 git remote update origin --prune 查看所有分支 git branch -a 删除远程分支Chapater6 git push origin --delete Chapater6 删除本地分支 Chapater6 git branch -d Chapater6当Git无法自动合并分支时,就必须首先解决冲突。解决冲突后,再提交,合并完成。 解决冲突就是把Git合并失败的文件手动编辑为我们希望的内容,再提交。 用git log --graph命令可以看到分支合并图 四.git 不好解决的冲突使用笨方法 1.把修改后的代码备份 2.然后删除项目 3.重新远程仓库clone一份最新的代码 4.然后把你之前修改的代码替换到对应文件夹 5.然后就在重新提交 五.开源项目上传到远程仓库. 详细步骤: 1.初始化 git init2.连接远程仓库 git remote add origin 远程地址https:..........3.创建分支 git branch -M master4.添加当前目录下的所有文件到暂存区 git add .5.git commit 添加备注信息 git commit -m '备注信息'6.提交代码到分支 git push -u origin master7.输入账号和密码(密码就是生成的token) 密码就是生成的ghp_vOfJ611.........8.完成代码上传到远程仓库 bug遇到报错的问题? error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054解决方法:设置Git忽略ssl证书错误即可 git config --global http.sslVerify "false"报错:远程:对密码身份验证的支持已于2021年8月13日删除。请改用个人访问令牌。 遥控器:请看https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ 了解更多信息。 remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.解决方法: 2021年8月13日之后对git hub 的账户和密码要使用个人访问令牌 或者ssh 或者token进行提交代码1.使用token 设置->在左侧边栏中,点击开发人员设置->在左侧边栏中,单击个人访问令牌->单击生成新令牌->为您的令牌指定一个描述性名称->要让您的令牌到期,请选择到期下拉菜单,然后单击默认值或使用日历选择器->选择您要授予此令牌的范围或权限。要使用您的令牌从命令行访问存储库,请选择repo->单击生成令牌->点击复制(保存起来用于提交代码时输入这个密码)直接粘贴就可 英文: Settings->Developer settings ->Personal access tokens->Note(添加描述)->Expiration(选择日历)->repo(授予此令牌权限进行勾选)->Generate token->Enable sso(这一步可直接复制到一个可保存的地方使用,之后将会看不到这个token了) git本地上传到gitlab详细步骤: https://www.cnblogs.com/jpfss/p/10925852.html总结报错: 一: git推送报错 Your branch is ahead of ‘origin/master’ by 1 commit 说明没有文件需要commit,但是本地仓库 有一个commit ahead原来的master,就是本地仓库有一个提交,比远程仓库要先进一个commit。git push origin master之后,再用git staus,打印信息为: On branch master nothing to commit (working directory clean)解决方法: 直接提交用户上传 git push origin master二:git add .提交出现 原因是路径中存在 / 的符号转义问题,false就是不转换符号默认是true,相当于把路径的 / 符号进行转义,这样添加的时候就有问题 warning: LF will be replaced by CRLF in ...... The file will have its original line endings in your working directory.解决方法: git config --global core.autocrlf false之后git add . ->git commit -m ‘提交信息’ 然后git commit -m ‘提交信息’ 会再次报错---------------------- $ git commit -m '提交待确认客户人员' Author identity unknown *** Please tell me who you are. Run git config --global user.email "[email protected]" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository.解决方法: $ git config --global user.email '邮箱' $ git config --global user.name '用户名'提交代码 git push origin master遇到问题:Git: pull时提示 Git: pull时提示Please commit your changes or stash them before you merge. 对本地的代码进行修改后,直接git pull会提示本地代码和github代码冲突,需要先commit本地代码,或者stash他们 解决方法: git stash: 将改动藏起来 git pull:用新代码覆盖本地代码 git stash pop: 将刚藏起来的改动恢复 这样操作的效果是在最新的仓库代码的基础仍保留本地的改动 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |