添加Git 远程仓库

xiaoxiao2021-02-28  111

首先需要生成ssh-key

ssh-keygen -t rsa -C "youraccount@example.com"

其中youraccount@example.com 为你的github邮箱 成功后打开保存RSA秘钥的目录(默认为./.ssh/) id_rsa.pub为你的公钥,打开文件复制其全部内容

进入github点开设置,点击New SSH key

可以用 ssh -T git@github.com 来测试是否成功, 会返回如下

Hi xxxxx! You've successfully authenticated, but GitHub does not provide shell access.

创建仓库(Repository)

git init

设置远程仓库

git remote add origin git@github.com:your_account/sample.git

即将你的远程git仓库sample.git 命名为origin

然后需要在github上创建sample仓库

最后提交

git add . git commit -m "first commit" git push -u origin master
转载请注明原文地址: https://www.6miu.com/read-44721.html

最新回复(0)