git遇到的问题之“Please make sure you have the correct access rights and the repository exists.”
对于git的提交一直很小心翼翼,感觉一不小心就会踩到莫名的坑。
这不,
某天commit 就遇到了On branch master nothing to commit (working directory clean)
一查意思。你的分支很干净?
干净?excuse me?
然后git push origin master一下,漫长等待了弹出了fail:#¥%@(此处省略,我们看重点)
Please make sure you have the correct access rights and the repository exists.
然后谷歌了一下,原来是ssh key有问题,连接不上服务器~~
然后我开始了死胡同~~
参阅了很多的答案,发现写的都不是很完整,自己东摸索西摸索搞定了,怕忘记,记录一下
1、首先我得重新在git设置一下身份的名字和邮箱(因为当初都忘了设置啥了,因为遇到坑了)进入到需要提交的文件夹底下(因为直接打开git Bash,在没有路径的情况下,根本没!法!改!刚使用git时遇到的坑。。。)
git config --global user.name "yourname"
git config --global user.email“your@email.com"
注:yourname是你要设置的名字,your@email是你要设置的邮箱。
2、删除.ssh文件夹(直接搜索该文件夹)下的known_hosts(手动删除即可,不需要git)
3、git输入命令
$ ssh-keygen -t rsa -C "your@email.com"(请填你设置的邮箱地址)
接着出现:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
请直接按下回车
然后系统会自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub
将全部的内容复制
4、打开https://github.com/,登陆你的账户,进入设置
进入ssh设置
在key中将刚刚复制的粘贴进去
点击add ssh key,
ok!
5、在git中输入命令:
ssh -T git@github.com
然后会跳出一堆话。。
输入命令:yes
回车
然后就会提示你成功了~~
泪牛满面~~
最后退出git重新进入路径提交一下就可以了~~
相关文章
- PRVF-5436 : The NTP daemon running on one or more nodes lacks the slewing option "-x"
- The three top-paying tech roles in 2022 and the skills you need to land them
- What's the difference between HEAD^ and HEAD~ in Git?
- What's the difference between HEAD, working tree and index, in Git?
- The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1.
- 报错:The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
- 解决Maven打包时报错"The packaging for this project did not assign a file to the build artifact"
- Git: GIT_SSH GIT_SSH_COMMAND
- The reference to entity "characterEncoding" must end with the ';' delimiter
- git遇到error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed failed怎么办?
- .NET错误The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework
- git所有分支和提交搜索
- 【解决方案】ERROR: lib/bridge_generated.dart:837:9: Error: The parameter ‘ptr‘ of the method ‘FlutterRustB
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- 程序员2020年新书推荐之 《Coders: The Making of a New Tribe and the Remaking of the World》
- MYSQL导入csv类型的数据出现The MySQL server is running with the --secure-file-priv option
- VSCode设置命令行终端为Git
- 异常:The last packet sent successfully to the server was 0 milliseconds ago解决
- The library 'xxx.jar' contains native libraries that will not run on the device. 解决方法(Eclipse)
- git 命令行中文乱码
- git基本命令
- Unity 报错之 The same field name is serialized multiple times in the class or its parent class.
- Linux下安装Git、git命令介绍
- git 本地提交后如果让服务器上的GIT 自动更新拉取
- 若依前后端分离部署,出现 “无法访问系统资源 401”或者 “The request was rejected because the URL contained a potentially malicious String
- 版本控制工具 Git SourceTree 推送分支时,没有分支可以选择
- Git:vscode stash drop误删恢复/git stash drop恢复
- The CompilerVersion constant identifies the internal version number of the Delphi compiler.