Git远程仓库

查询别名

git remote -v

创建别名

git remote add git_init git@github.com:guoliagn/git_init.git

https不好使,SSH好用。提交仓库

git push git_init(可以是网址) master

提交github会出现

$ git push git_init1 master
The authenticity of host 'github.com (13.114.40.48)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

这个时候说明我们没有权限上传,需要对SSH密钥进行设置。
本文参考博客 https://blog.youkuaiyun.com/helloasimo/article/details/123778112
解决方案:
1.git config --global --list 验证邮箱与GitHub注册时输入的是否一致
在这里插入图片描述
2.ssh-keygen -t rsa -C “这里换上你的邮箱”,一路回车,在出现选择时输入Y,再一路回车直到生成密钥。
在这里插入图片描述
会在/Users/***/路径下生成一个.ssh文件夹,密钥就存储在其中:
在这里插入图片描述
在这里插入图片描述
然后new SSH keys,加入你的密钥即可。
在这里插入图片描述
在这里插入图片描述
用ssh -T git@github.com 测试一下通不通,通了显示如下
在这里插入图片描述
即可正常使用。
不通就是
ssh-agent -s
ssh-add ~/.ssh/id_rsa 操作这两步。
参考博客:https://blog.youkuaiyun.com/helloasimo/article/details/123778112
克隆代码

git clone 网址

在这里插入图片描述
clone会做如下操作。1、拉取代码。2、初始化本地仓库。3、创建别名

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值