【Git】Please make sure you have the correct access rights

五一在家办公,想去 git pull 一下某个项目,发现马上就报错说没有权限了。

Please make sure you have the correct access rights

这个问题有点奇怪,然后在云开发机上测试了一下,发现 ssh key 是没问题的,就没有继续往 ssh key 的方向去想了。然后开始怀疑网络问题,因为公司网络策略的问题,内网和外网通过 VPN 访问公司局域网是有差异的,怀疑是做了 ip 等限制。另外就是我的 .gitconfig,是有特殊配置的,也就是所有 https 都会转换成 ssh 请求。

# ~/.gitconfig
[url "git@git.xxx.com:"]
    insteadOf = https://git.xxx.com/
[url "git@git.xxx.com:"]
    insteadOf = http://git.xxx.com/

然后再测试一下 git clone https://xxx.git ,发现 https 是没问题的,所以马上就怀疑对 ssh 做了限制,最后在公司的 Git Q&A 的文章里找到了,确实就是这个原因。

本文想说一件事,就是如果 ssh 报 access rights 之类的问题,有时候还真不是 ssh key 有问题,就不要浪费太多时间去重新创建 ssh 的公钥秘钥了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Git is a distributed version control system, widely used in software development to manage and track changes made to code repositories over time. It was designed by Linus Torvalds for the Linux kernel project and has since become the de facto standard for managing source code collaboration. Here's a brief overview of key concepts in Git: 1. Repository: A Git repository is a central location where all the files and their versions are stored. Each repository has a local copy on your computer, as well as a remote copy on a server or online platform like GitHub. 2. Working directory: This is the folder on your local machine that contains the latest version of the files from the repository. You can make changes here and stage them for committing. 3. Commit: A commit is a snapshot of the current state of your working directory. It includes all changes, along with a message describing what you've done. Commits are saved locally and can be pushed to the remote repository. 4. Branches: In Git, you can create multiple branches, which are separate lines of development. This allows developers to work on different features or bug fixes without interfering with each other's work. 5. Merge: When a branch is ready to be integrated into the mainline code, developers can merge the changes from one branch into another using `git merge`. 6. Pull request: A pull request is a way to propose changes to a shared codebase. You create a request on a remote repository, asking others to review and potentially merge your changes. 7. Stashing: If you need to switch between tasks but don't want to lose your changes, Git allows you to stash them temporarily.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值