Git+码云构建自己的共享仓库

首先下载Git和TortoiseGit

Git:https://git-scm.com/downloads

TortoiseGit:https://tortoisegit.org/download/

 注册码云账号

https://gitee.com/

由于git是分布式管理工具,需要输入用户名和邮箱作为标识,因此右键打开Git Bash命令框

输入命令

git config --global user.name 'LNM'

git config --global user.eamil '2607586064@qq.com'

 生成SSH公钥,提交代码到仓库的时候需要认证姓名和邮箱,所以需要把这些信息进行加密生成公钥

输入命令,确认三次

ssh-keygen -t rsa -C "2607586064@qq.com"

 到.ssh文件夹下找到生成的公钥

 打开id_rsa.pub文件复制里面的内容

 打开码云->设置->ssh公钥,添加公钥

 新建一个仓库,复制其ssh

 新建一个文件夹,输入命令git init

 再输入命令连接码云仓库

git remote add origin + ssh

 设置TortoiseGit的网络

 到此设置完成,可以通过TortoiseGit拉取和推送文件了

如果出现这种错误

解决办法

在本地的文件夹下Git Bash Here,输入命令

git config --global push.default current

git push -u

原文地址:https://www.cnblogs.com/tommao2618/p/14843055.html