您的位置:首页 > 其它

添加Git 远程仓库

2017-08-31 16:25 120 查看
首先需要生成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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: