github-problem fixes

本文详细介绍了Git在日常使用中常见的问题及解决方法,包括拉取代码后本地未更新、登陆GitHub异常、错误的commit信息修正、公钥配置失败及连接被拒绝等问题,提供了实用的步骤指导。

git pull拉取成功后,本地代码未更新

依次运行:

git add .
git commit -m 'backup'
git stash

继续pull:

git pull origin 分支名

登陆不上github

在这里插入图片描述
主要参考以下博客:

https://blog.youkuaiyun.com/qq_36977697/article/details/106710031

填错commit信息

如果填错commit信息但还没有push,还有修改机会。

git commit --amend

使用上述代码编辑commit信息,:wq保存并退出,之后继续push

push失败

已添加公钥但push失败

在这里插入图片描述

could not read from remote repository

环境:
本例window10下载使用Git Bash客户端
1.命令

ssh-keygen -t rsa -C  邮箱地址

例如: ssh-keygen -t rsa -C youremail@163.com
本命令提示输入信息,回车即可

2.命令

ssh -v git@github.com

3.命令

ssh-agent -s

4.命令

eval `ssh-agent -s`

5.命令

ssh-add ~/.ssh/id_rsa_github
//这里对应的改成自己的id_rsa文件名,默认是id_rsa

6.在本例生成的id_rsa.pub在C:\Users\ 用户名 \.ssh

7.在github账号下设置
1>.进入github账号,
2>.在settings页面,找到SSH and GPG keys
3>.点击SSH keys 新建SSH keys
4>.填写title(自定义名称),
5>.将id_rsa.pub里的内容复制到Key中
6>.点击Add SSH Key,完成
如图:
注意:
在C:\Users\lenovo.ssh下有id_rsa和id_rsa.pub
需完整复制id_rsa.pub内容
否则可能报错:
Key is invalid. It must begin with ‘ssh-ed25519’, ‘ssh-rsa’, ‘ssh-dss’, ‘ecdsa-sha2-nistp256’, 'ecds…

8.验证命令

ssh -T git@github.com

connection refused

在这里插入图片描述
fatal: unable to access ‘https://github.com/dokdzym/LeetCode.git/’: Failed to connect to 127.0.0.1 port 12639: Connection refused

解决方法:
键入env|grep -i proxy,看到有多个代理
在这里插入图片描述
键入unset http_proxyunset https_proxy将代理取消,恢复正常

问题发现:
每次打开新的git bash都需要重新unset一次代理,否则会refused。并且一些app出现异常(登录不上、加载不了图片等)
后来发现是环境变量里设置了http_proxy 和 https_proxy,删除,重启之后一切正常。

C:\Users\qusg>appium-doctor WARN AppiumDoctor [Deprecated] Please use appium-doctor installed with "npm install @appium/doctor --location=global" info AppiumDoctor Appium Doctor v.1.16.2 info AppiumDoctor ### Diagnostic for necessary dependencies starting ### info AppiumDoctor ✔ The Node.js binary was found at: C:\own\app\Node\node.EXE info AppiumDoctor ✔ Node version is 22.18.0 WARN AppiumDoctor ✖ ANDROID_HOME environment variable is NOT set! info AppiumDoctor ✔ JAVA_HOME is set to: C:\own\app\JDK WARN AppiumDoctor ✖ adb, android, emulator, apkanalyzer.bat could not be found because ANDROID_HOME or ANDROID_SDK_ROOT is NOT set! info AppiumDoctor ✔ 'bin' subfolder exists under 'C:\own\app\JDK' info AppiumDoctor ### Diagnostic for necessary dependencies completed, 2 fixes needed. ### info AppiumDoctor info AppiumDoctor ### Diagnostic for optional dependencies starting ### WARN AppiumDoctor ✖ opencv4nodejs cannot be found. WARN AppiumDoctor ✖ ffmpeg cannot be found WARN AppiumDoctor ✖ mjpeg-consumer cannot be found. WARN AppiumDoctor ✖ bundletool.jar cannot be found WARN AppiumDoctor ✖ gst-launch-1.0.exe and/or gst-inspect-1.0.exe cannot be found info AppiumDoctor ### Diagnostic for optional dependencies completed, 5 fixes possible. ### info AppiumDoctor info AppiumDoctor ### Manual Fixes Needed ### info AppiumDoctor The configuration cannot be automatically fixed, please do the following first: WARN AppiumDoctor ➜ Make sure the environment variable ANDROID_HOME is properly configured for the Appium process. Refer https://github.com/appium/java-client/blob/master/docs/environment.md for more details. WARN AppiumDoctor ➜ Manually configure ANDROID_HOME and run appium-doctor again. info AppiumDoctor info AppiumDoctor ### Optional Manual Fixes ### info AppiumDoctor The configuration can install optionally. Please do the following manually: WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: http://appium.io/docs/en/writing-running-appium/image-comparison/ WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'. WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it. Also consider adding the ".jar" extension into your PATHEXT environment variable in order to fix the problem for Windows WARN AppiumDoctor ➜ gst-launch-1.0.exe and gst-inspect-1.0.exe are used to stream the screen of the device under test. Please read https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/ to install them and for more details info AppiumDoctor info AppiumDoctor ### info AppiumDoctor info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied! info AppiumDoctor 表明appium运行依赖环境是否全部安装成功
最新发布
10-14
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值