连接github

来源:互联网 发布:mysql配置参数详解 编辑:程序博客网 时间:2024/06/05 09:17

本地克隆到远程库

第1步:创建SSH Key。

在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key    ssh-keygen -t rsa -C "youremail@example.com"

2.创建一个新的仓库

登陆GitHub,然后,在右上角找到“Create a new repo”按钮

3.创建了一个新的Git仓库

点击“Create repository”按钮

4.把一个已有的本地仓库与之关联,然后,把本地仓库的内容推送到GitHub仓库。

git remote add origin https://github.com/zyg5467/learngit.git1) 把本地库的所有内容推送到远程库上:    git push -u origin master    -u参数,Git不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来2) 从现在起,只要本地作了提交,就可以通过命令    git push origin master3) remote origin already exists.    git remote rm origin

远程库克隆本地

git clone https://github.com/zhangyongguang/githug.git
0 0
原创粉丝点击