git基本使用

1,创建本地仓库并关联远程仓库

1.1创建远程仓库

1.2创建文件夹

1.3cd 文件夹

echo "# AcceleratedCoding" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:GitHub账户名/项目名.git
git push -u origin master

2,登陆时候,遇到的问题

Warning: Permanently added the RSA host key for IP address '13.250.177.223' 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密钥

ssh-keygen -t rsa -b 4096 -C "Your email"

 进入文件目录

cd ~/.ssh/
ls

出现:

id_rsa         id_rsa.pub

左边公钥匙,右边私钥

一般操作是把公钥的全部内容复制出来

粘贴到

Settings中的SSH和GPG keys中的SSH中即可。

 

 

 

 

 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 岁月 设计师:pinMode 返回首页