树莓派3B+ Git服务

短命女 2022-06-03 05:57 415阅读 0赞

树莓派3B+ Git服务


Git是一个很棒的代码管理仓库。


1.安装Git服务

  1. sudo apt-get install -y wget git-core
  2. // 添加一个 git 用户和组
  3. adduser --system --shell /bin/bash --gecos 'git version control by pi' --group --home /home/git git
  4. // 更改密码:
  5. passwd git

2.初始化项目仓库

可选方法一:新建一个空的仓库

  1. // 增加一个空的Git仓库(Git Repository)
  2. su git
  3. cd ~
  4. // 初始化并清空仓库。
  5. mkdir test.git
  6. cd test.git
  7. git --bare init

可选方法二:直接克隆github的项目到服务器

  1. git clone https://github.com/xiaanming/SlideCutListView.git ~/github.git

3.下拉项目

如果你想要测试一下,试着clone你的仓库到你的Windows机器上。首先更改路径到你希望存储clone的地方(一个空文件夹),然后通过命令行(或git bash),运行:

  1. git clone git@192.168.1.120:~/test.git

4.上传项目(提交修改)

  1. // Push你的代码到Pi上
  2. git remote add pi git@192.168.1.120:~/test.git
  3. // 现在你要做的就是add你的代码,commit然后push。
  4. git add .
  5. git commit -am "初始化代码"
  6. git push pi master
  7. // 如果你得到了一个类似这样的消息”authenticity of host …”只需要输入”yes”然后继续就可以了。

发表评论

表情:
评论列表 (有 0 条评论,415人围观)

还没有评论,来说两句吧...

相关阅读