通过VSCode上传文件夹至github

如果是第一次连接github账户,则需要设置ssh。

查看用户名和邮箱地址:
$ git config user.name

$ git config user.email
修改用户名和邮箱地址:

$  git config --global user.name  "xxxx"

S  git config --global user.email  "xxxx"

生成SSH Key的秘钥对:参考博客

ssh-keygen -t rsa  #在某个位置生成秘钥对,文件位置会在结果给出
将id_rsa.pub文件内容复制粘贴到github中
ssh -T git@github.com  #运行该命令进行验证

首先在GitHub上创建一个Repository,复制url
在这里插入图片描述
在一个空文件夹中打开终端,输入

git clone url

而后即可用VSCode打开文件夹,使用其功能进行push pull功能了
在这里插入图片描述
上传步骤为:commit all ->push
拉取即为pull
commit时需要写一些提交备注。
实际上VSCode还提供其他的一堆命令,不过这几个命令就够用了,出了问题再用其他的

tip:
1 拉取仓库时修改url

git clone git://github.com/spdk/spdk
git clone https://github.com.cnpmjs.org/spdk/spdk

而后在.git/config文件中改回来,这样拉取的速度可以加快。
vscode设置git文件可见
在这里插入图片描述

2 上传时不能开代理,否则会出现一些问题
OpenSSL SSL_read: Connection was reset, errno 10054
实际上我只是因为打开了clash,不是上述的原因,不过可以通过以下命令修改github最大文件限制

git config  --global http.postBuffer 5242880003

3 GnuTLS recv error (-110): The TLS connection was non-properly terminated

#方法1
apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000
#方法2
重置代理,解决
git config --global  --unset https.https://github.com.proxy 
git config --global  --unset http.https://github.com.proxy 
//取消http代理
git config --global --unset http.proxy
//取消https代理 
git config --global --unset https.proxy

方法3
Stack Overflow中里说需要用源码重新编译
方法4(我自己的方法):

 #遇到该问题时,先检测与github.com是否连通
 ssh -T git@github.com #-T 不显示终端,只显示连接成功信息
 报错The authenticity of host 'github.com (20.205.243.166)' can't be established
 输入yes,回车后再运行 ssh -T git@github.com,此时成功
 Hi 1020xyr! You've successfully authenticated, but GitHub does not provide shell access.
 而后推送到github就没有报错了

不过我之前也成功推送过,不知道具体原因。。。

迁移至gitee…,github访问太多问题
好像用ssh方式推送能避免很多问题,不过已经迁移完了。
git remote add增加远程仓库,也可以直接修改./git/config文件url
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Git Clone错误解决:GnuTLS recv error (-110): The TLS connection was non-properly terminated

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

最佳损友1020

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值