zoukankan      html  css  js  c++  java
  • Git版本控制工具(1)

    学习Git的最佳资料网站:

    https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/

    这是廖雪峰,廖老师为了让大家少走弯路而辛苦准备的中文Git学习资料。感谢他!对于英文不好的朋友可以去看看,不一定全看,学会基础的几个命令就好,里面有些名词可能一时半会理解不了,但是用多了,自然就会明白。不过资料中的电脑操作系统不是Windows,但是git命令是通用的这个不用担心,如果你用的是Windows系统,那么在搜索相关资料的时候最好加上一个windows 前缀。

    如果你用Windows系统,再使用Git命令之前,先安装Git软件:

    http://jingyan.baidu.com/article/020278117cbe921bcc9ce51c.html

    进行路径配置:

    http://blog.csdn.net/exlsunshine/article/details/18939329

    对Git设置ssh密码,将密码拷贝到GitHub官网自己的账号上:

    http://www.cnblogs.com/vitah/p/3612473.html

    在GitHub官网上有一个免费的翻墙软件Lantern,普通用户每月有免费几百兆的流量使用:

    https://github.com/getlantern/lantern/releases/tag/latest

    下面是SSH密码配置成功的提示:

    可能有的朋友会遇到这种或者哪种

    Git是什么?百度来解释:

    https://baike.baidu.com/item/GIT/12647237?fr=aladdin

    版本控制工具分为两种:

    集中式版本控制,代表SVN:https://baike.baidu.com/item/SVN/3311103?fr=aladdin

    分布式版本控制,代表Git:https://baike.baidu.com/item/GIT/12647237?fr=aladdin

    看不懂没关系,我们慢慢来。

    Git有Windows版本:https://git-scm.com/

    Download for Windows就是。

    Git Shell

     这是命令行

    进入自己想要创建仓库的文件夹,

    接下来运行命令:

    1. git init //把当前目录创建为代码仓库(repertory),创建成功后,该目录下会生成一个.git隐藏文件夹,ls命令查看不了,Win10系统可以通过图形界面进入当前文件夹,并进行如下操作: 点击查看,将隐藏的项目打钩,就可以看到有一个.git文件夹。

    2. 右击,在里面创建新文件夹,或者新文件(Windows系统应该会新建文件夹或文件)

    3. git add Android.txt //添加新文件

        git add src//添加新文件夹

        git add . //添加当前文件夹下所有文件和文件夹

    4. git commit -m "First commit." //提交添加的文件,-m参数,用来加上对提交的文件的描述信息,没有描述信息的提交时不合法的。描述信息就是对此次提交进行备注。

    上述步骤,只是将代码提交到了本地。想要提交到远端的GitHub上还需要命令操作,不过先暂停一下,我们看一下其他命令。

    对Git配置成功才可以进行下面操作,从GitHub官网上下载自己想要的一些项目代码:

    下载之前,要先将下载网址复制下来如下图:

    进入一个已经git init过的文件夹,执行下面操作:

    git clone https://github.com/lanshanxiao/yunweather.git

    它是下载到了Head-First-Java文件夹中,里面有一个隐藏的.git文件,所以你对Head-First-Java进行操作最好进入文件夹中,以后向远端推送文件不会报错。或者将Head-First-Java文件夹中的所有内容复制到当前文件夹,把当前.git文件夹覆盖掉,向远端推送最重要的是这个隐藏的.git文件夹,如果网站上的.git和你的.git不一致,你就不能pull和push,向下面的错误一样。切记!

    F:Head-First-Java [master]> git pull origin master
    fatal: 'origin' does not appear to be a git repository
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    F:Head-First-Java [master]> git push origin master
    fatal: 'origin' does not appear to be a git repository
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

  • 相关阅读:
    windows安装php的redis扩展及测试(适合php个各个版本)
    golang+linux+pipline
    泰勒展开式
    微积分
    矩阵
    learning rate warmup实现
    python asyncio as_completed
    python asyncio run_until_complete
    python asyncio 使用ThreadPoolExecutor和asyncio完成阻塞IO请求
    python asyncio call_soon, call_at, call_later
  • 原文地址:https://www.cnblogs.com/lanshanxiao/p/7236274.html
Copyright © 2011-2022 走看看