这篇文章详细讲解了如何生成SSH,并链接到GitHub,http://www.cnblogs.com/Gabriel-Wei/p/6564060.html
1.如果你的GitHub里面没有仓库,就自己生成一个,如图所示
2.如果你有自己仓库,想在电脑本地新建一个,你需要将GitHub的仓库地址复制下来,注意使用的是ssh,如图所示,
3.在电脑本地新建一个文件夹,将我们的远程仓库clone下来,
我是在d盘,test文件夹下面,直接右击选择git bash here
Administrator@LS--20160817QEI MINGW32 /d/test
输入下面的命令
$ git clone git@github.com:Gabrielkaliboy/markdown.git
git会返回下面的文字
Cloning into 'markdown'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (8/8), done.
), reused 11 (delta 0), pack-reused 0
Receiving objects: 100% (12/12), 23.26 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
Checking connectivity... done.
此时我们再去看我们的文件夹目录,已经顺利将文件clone到了本地
4.我们切入下载下来的文件夹(markdown),进行一些操作,我们可以看到多了一个单词,master
$ cd markdown
5.我们往markdown文件夹里面放多个文件,然后查看一下当前的状态
在markdown里面新建文件里面,查看一下当前的状态
$ git status
git会给我们返回这个信息
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add
<file>..." to include in what will be committed)
images/webDaily/
"markdown\344\275\277\347\224\250\346\212\200\345\267\247.md"
"\345\211\215\347\253\257\346\227\245\345\270\270\350\256\260\345\275\225.md"
nothing added to commit but untracked files present (use "git add" to track)
6.将多个文件同时提交到暂存区(或者将多个被修改的文件同时进行提交)
$ git add -A .
没有任何返回
7.我们再次查看一下当前的状态
输入命令:
$ git status
git返回:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD
<file>..." to unstage)
new file: images/webDaily/1.jpg
new file: "markdown\344\275\277\347\224\250\346\212\200\345\267\247.md"
new file: "\345\211\215\347\253\257\346\227\245\345\270\270\350\256\260\345\275\225.md"
8.将暂存区的文件提交到GitHub分支
-m右面是此次提交的信息说明,输入命令:
$ git commit -m"提交新的文件"
Git会给我们返回:
[master eea6990] 提交新的文件
3 files changed, 111 insertions(+)
create mode 100644 images/webDaily/1.jpg
create mode 100644 "markdown\344\275\277\347\224\250\346\212\200\345\267\247.md"
create mode 100644 "\345\211\215\347\253\257\346\227\245\345\270\270\350\256\260\345\275\225.md"
9.再次查看当前的本地仓库状态
输入命令:
$ git status
Git返回的信息:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
他提示我们将分支提交到主分支
10还没有结束,我们需要将我们的文件推送到分支
输入:
$ git push -u origin master
Git返回:
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 7.85 KiB | 0 bytes/s, done.
Total 7 (delta 0), reused 0 (delta 0)
To git@github.com:Gabrielkaliboy/markdown.git
cd8d69d..eea6990 master -> master
Branch master set up to track remote branch master from origin.
11.此时再次查看一下仓库状态
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
只要你对工作区没有任何的修改,工作区就是干净的
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com