首页 > 其他 > 详细

新手使用git(亲测可用)

时间:2017-06-24 20:41:36      阅读:375      评论:0      收藏:0      [点我收藏+]
  1. 下载git

    https://git-scm.com/downloads

    技术分享

  2. 下载安装

    技术分享

    一路回车

  3. 安装好之后,到git的安装目录,打开git-bash.exe

    技术分享

  4. 输入命令行

  5. 首先进入你要创建仓库的目录

    初始化一个Git仓库,使用git init命令。

    添加文件到Git仓库,分两步:

    第一步,使用命令git add <file>,注意,可反复多次使用,添加多个文件;

    第二步,使用命令git commit,完成。

  6. 设置  git config --global user.email "youremail@example.com"

  7. 同样 的设置 git config --global user.name "example"

  8. git输入命令ssh-keygen -t rsa -C "youremail@example.com"

  9. windows下在user/用户名/里面找到.ssh文件夹 复制id_rsa.pub内容到github,登陆GitHub,打开"Account settings","SSH Keys"页面:然后,点"Add SSH Key",填上任意Title,在Key文本框里粘贴 id_rsa.pub 文件里面的所有内容,配置好ssh后之后

  10. 添加后,在终端(Terminal)中输入

  11. ssh -T git@git.oschina.net
  12. 若返回

  13. Welcome to Git@OSC, yourname!
  14. 则证明添加成功。

  15. 接下来总结一下步骤:

  16. 1、在github上创建项目

    2、使用git clone https://github.com/xxxxxxx/xxxxx.git克隆到本地

    3、编辑项目

    4、git add . (将改动添加到暂存区)

    5、git commit -m "提交说明"

    6、git push origin master 将本地更改推送到远程master分支。

    这样你就完成了向远程仓库的推送。

  17. 如果在github的remote上已经有了文件,会出现错误。此时应当先pull一下,即:

  18. git pull origin master
  19. 然后再进行:

  20. git push origin master


新手使用git(亲测可用)

原文:http://itafei.blog.51cto.com/10862892/1941516

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!