windows下git客户端的下载安装及使用教程

编程知识 更新时间:2023-04-17 14:26:30

1,下载及安装可参考如下百度经验:

https://jingyan.baidu/album/020278117cbe921bcc9ce51c.html?picindex=1

2,git初始化 项目用户名和邮箱:

git config --global user.name "username"

git config --global user.email "email"

3,获取公钥

出现如下错误时:

Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts.

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

是因为,没有在github账号添加SSH key

此时按时如下操作:

1)ssh-keygen -t rsa -C "....@..." //邮箱

2)输入保存路径(可使用括号提示中的路径,复制粘贴即可)

3)  输入私钥密码

4, git中使用命令将远程仓库拉取项目在本地文件夹

打开gitlab中的项目,点击右上角个人头像旁的倒三角,点击”settings",然后"SSH KEYS“,将第3点中生成的id_rsa.pub中的公钥复制进去,保存即可

5,第4步完成后,在git bash中输入

git clone ssh://git@......:22222/.........git

即可拉取gitlab中的项目

6,进入项目的目录中,即可进步git命令操作

7,修改remote方式

如果之前用的是https,那么需要将remote改为ssh;如果已经是ssh则不需要修改。

可以通过如下命令来查看当前的remote方式: 
git remote -v

如果当前是https的,那么可以通过如下命令修改为ssh: 
git remote set-url origin git@github:account/project.git

8,如果希望在git pull时不输入密码:

通过如下命令将密钥添加到ssh即可: 
ssh-add

注: 从openSSH 8.8版本开始,不再支持rsa加密生成的密钥

我们可以使用如下算法生成:

ssh-keygen -t ed25519 -C "15090552277@163"

更多推荐

windows下git客户端的下载安装及使用教程

本文发布于:2023-04-14 00:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/a8a6bf5dd58cf20cb5622d151adb4f24.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   教程   windows   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 74124文章数
  • 14阅读数
  • 0评论数