简体   繁体   English

无法从 gitlab 将 ssh/https 克隆到我的 mac

[英]Cant clone ssh/https to my mac from gitlab

I have had an issue with pushing/pulling changes to GitLab, so I decided to remove the git repository on my mac.我在向 GitLab 推送/拉取更改时遇到问题,因此我决定删除 mac 上的 git 存储库。

However, now it wont let me clone the project again.但是,现在它不会让我再次克隆该项目。
I am met with various error messages and have tried everything to fix the problem, with no luck.我遇到了各种错误消息,并尝试了所有方法来解决问题,但没有成功。 I cant clone with either SSH or HHTPS.我无法使用 SSH 或 HHTPS 进行克隆。

I have now deleted my ssh-key and made a new one (I think) that I have connected to GitLab.我现在删除了我的 ssh-key 并制作了一个新的(我认为)我已经连接到 GitLab。

I will provide a picture and text with the error messages I get:我将提供图片和文字以及我收到的错误消息:

https://i.stack.imgur.com/J39g0.png

marcus@Marcuss-MacBook-Pro-2 cd .git
marcus@Marcuss-MacBook-Pro-2 .git % git clone git@gitlab.stud.idi.ntnu.no:marcuslj/rentadog-git 
Cloning into 'rentadog'... 
ssh: connect to host gitlab.stud.idi.ntnu.no port 22: Operation timed out
fatal: Could not read from remote repository.

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

marcus@Marcuss-MacBook-Pro-2 .git git clone https://gitlab.stud.idi.ntnu.no/marcuslj/rentadog.git 
Cloning into 'rentadog'...
Username for 'https://gitlab.stud.idi.ntnu.no: marcuslj
Password for 'https://marcuslj@gitlab.stud.idi.ntnu.no
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.stud.idi.ntnu.no/help/topics/git/troubleshooting.git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.stud.idi.ntnu.no/marcuslj/rentadog.git/'
marcus@Marcuss-MacBook-Pro-2 git %

I first try with SSH, then HTTPS as you can see.如您所见,我首先尝试使用 SSH,然后尝试使用 HTTPS。 None of them work.它们都不起作用。 Have already scattered all over the inte.net to try and find a solution, with no luck.已经分散在整个 inte.net 上尝试找到解决方案,但没有运气。

Now I am at the point where I just want to reinstall git completely, which I have also tried and didn't manage to do...现在我只想完全重新安装 git,我也尝试过但没能做到...

So anyways, if anyone could help me, that would be great.所以无论如何,如果有人能帮助我,那就太好了。

While you might have a.network/firewall issue preventing you to use SSH, HTTPS should work.虽然您可能有网络/防火墙问题阻止您使用 SSH,但 HTTPS 应该可以工作。

Make sure to create a PAT (Personal Access Token) , and use that as a password.确保创建一个PAT(个人访问令牌) ,并将其用作密码。

While you are at it, make sure the GCM (Git Credential Manager) is installed: that will help you to cache your credentials (username/token).当你这样做时,确保安装了GCM(Git 凭据管理器) :这将帮助你缓存你的凭据(用户名/令牌)。
That way, you won't have to re-enter them again on each push.这样,您就不必在每次推送时再次重新输入它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM