【Git】远程仓库
2016-02-15 00:00
148 查看
一、创建SSH Key
二、登陆GitHub => 打开“Personal settings” => "SSH Keys" => "New SSH Keys"
复制 id_rsa.pub内容到“Key”中并保存“Add SSH Key”。
https://github.com/settings/ssh
三、添加远程库
https://github.com/new
填写repository name => "create repository"
四、把本地已有git仓库关联到远程(先有本地仓库,后有远程仓库,如何关联)
五、从远程仓库克隆(先创建远程仓库,然后从远程仓库克隆)
$ ssh-keygen -t rsa ... ... ... $ ls ~/.ssh/ id_rsa id_rsa.pub known_hosts
二、登陆GitHub => 打开“Personal settings” => "SSH Keys" => "New SSH Keys"
复制 id_rsa.pub内容到“Key”中并保存“Add SSH Key”。
https://github.com/settings/ssh
三、添加远程库
https://github.com/new
填写repository name => "create repository"
四、把本地已有git仓库关联到远程(先有本地仓库,后有远程仓库,如何关联)
$ git init test-git $ git remote add origin git@github.com:harrywu0913/git-test.git => 把本地仓库关联到远程git-test 添加后远程的仓库名称叫做origin(是git的默认名称,也可以修改成其他的) $ cd test-git $ touch readme.txt $ git add readme.txt $ git commit -m "initial commit" => 在本地仓库中提交些内容 $ git push -u origin master => 把本地仓库push到远程仓库,即把当前分支master推送到远程origin分支 第一次要加-u git会把本地的master分支内存推送到远程新的master分支,还会把本地的master分支和远程的master分支关联。 $ cd test-git $ mkdir a $ touch a/a.txt $ git add a/* $ git commit -m "add directory a" $ git push origin master => 把本地新的提交推送到远程
五、从远程仓库克隆(先创建远程仓库,然后从远程仓库克隆)
$ git clone git@github.com:harrywu0913/git-test.git [new_repo_name]
相关文章推荐
- 你是个成熟的职场人么?
- 天下数据支招如何保证云计算信息安全
- mysql中INSERT INTO… ON DUPLICATE KEY UPDATE用法
- 创业的第一百二十一天
- Scrapy安装
- 使用hadoop mapperreduce来统计大文件的行数-续1
- 运行hadoop自带的wordcount例子
- 编译hadoop自带的wnordcout例子
- 前台慢加密实现
- 设计模式之禅-第一篇
- Kendo AUTOCOMPLETE
- android 学习 day day up
- 全文检索(一)
- 永中Office电子表格两行或两列互换宏
- OpenTSDB logo开源监控系统 OpenTSDB
- Linux 系统性能优化
- bigdata hadoop 面试问题一
- HDFS
- 学习:APP_ABI
- linux挂载ssd硬盘