GitHub是目前最火的开源项目代码托管平台。它是基于web的Git仓库,提供公有仓库和私有仓库,但私有仓库是需要付费的。
到Github上找类似的项目软件。
GitLab可以创建免费的私有仓库。
GitLab是利用 Ruby开发的一个开源的版本管理系统, 实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。 它拥有与Github类似的功能,能够浏览源代码,管理Bug缺陷和注释。可以管理团队对仓库的访问, 它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。


github的官网地址:github.com
Github上创建项目、仓库:
.git 就是git init产生的,就是版本库。
之前上传方法是:

有一个tokens的问题。



该README上传成功。
克隆项目到本地Linux,默认克隆到当前目录。

bash
[root@git-server ~]# cd Shell-100-Days/
[root@git-server Shell-100-Days]# ll
total 4
-rw-r--r-- 1 root root 5 Sep 19 20:03 README.md
[root@git-server Shell-100-Days]# cat README.md
haha
因为这个项目是Public,是公共开放的。所以下载的时候不需要账号密码。
git是一个分布式版本控制系统。大家都可以来下载代码。修改好,上传上来,确认是需要合并的。
模拟一个作者和一个用户:

该用户下载了Shell-100-days的这个项目:

在这个项目中增加了1.py文件:

然后用户还需要使用git push -u origin master的上传操作。
那这个还需要创建账号密码。
在上传的时候,一段时间会出现这个Connection refused的问题。



git pull和git clone的区别
git clone
是在本地没有版本库的时候,从远程服务器克隆整个版本库到本地(即将远程库整个下载到本地),是一个本地从无到有的过程。
git pull
在本地有版本库的情况下,从远程库获取最新commit 数据(如果有的话),并merge(合并)到本地。
git pull的时候,需要进入到版本库目录中,然后执行git pull的操作。

补充:
使用下面的命令可以实现https的密码缓存(下次不用再输密码了)
bash
git config --global credential.helper store
Author又进行了更新:
bash
[root@git-server test]# echo 2222 >> 2.py
[root@git-server test]# ll
total 12
-rw-r--r-- 1 root root 5 Sep 19 20:43 1.py
-rw-r--r-- 1 root root 5 Sep 19 20:43 2.py
-rw-r--r-- 1 root root 5 Sep 19 13:26 README.md
[root@git-server test]#
[root@git-server test]# git add *
[root@git-server test]#
[root@git-server test]# git commit -m "Added 2.py"
[master 3af54d0] Added 2.py
1 file changed, 1 insertion(+)
create mode 100644 2.py
[root@git-server test]#
[root@git-server test]# git push -u origin master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 300 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: To https://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@github.com/changchunhua2017/Shell-100-Days.git
e8333b1..3af54d0 master -> master
Branch master set up to track remote branch master from origin.
开启了账号密码缓存,那么这次就没有要求输入账号密码。

然后用户再在Shell-100-days中进行git pull命令的操作。
