首先,需要建立一个git服务器-----

这里介绍如何使用git这个服务器

我们在github上下载一份代码,里面有如下内容

我们使用git服务器的时候不能有.git 文件,所以在此将其删除

ys-linux@ubuntu:~/Documents/pc_simulator$ rm -rf .git
ys-linux@ubuntu:~/Documents/pc_simulator$ rm -rf .gitmodules

然后屏蔽上传编译文件

ys-linux@ubuntu:~/Documents/pc_simulator$ cat .gitignore 

然后创建一个git

登陆服务器创建一个账户

创建一个项目,名称叫kcsdr_ui
然后在终端输入
ys-linux@ubuntu:~/Documents/pc_simulator$ git init
Initialized empty Git repository in /home/ys-linux/Documents/pc_simulator/.git/
ys-linux@ubuntu:~/Documents/pc_simulator$ git remote add origin http://192.168.11.222/ys/kcsdr_ui.git
ys-linux@ubuntu:~/Documents/pc_simulator$ git remote -v
origin http://192.168.11.222/ys/kcsdr_ui.git (fetch)
origin http://192.168.11.222/ys/kcsdr_ui.git (push)
ys-linux@ubuntu:~/Documents/pc_simulator$ git status

On branch master

Initial commit

Untracked files:
(use "git add <file>..." to include in what will be committed)

.cproject
.gitignore
.project
Makefile
README.md
fontAndImg/
gui/
licence.txt
lv_conf.h
lv_drivers/
lv_drv_conf.h
lv_ex_conf.h
lv_examples/
lvgl/
main.c
misc_conf.h

nothing added to commit but untracked files present (use "git add" to track)

现在库创建好了,然后增加内容

ys-linux@ubuntu:~/Documents/pc_simulator$ git add .
ys-linux@ubuntu:~/Documents/pc_simulator$ git status
On branch master Initial commit Changes to be committed:
(use "git rm --cached <file>..." to unstage) new file: .cproject
new file: .gitignore
new file: .project
.......................................................
 

然后填写更新内容

ys-linux@ubuntu:~/Documents/pc_simulator$ git commit -m "<base> <first commit>"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
git config --global user.name "Your Name" to set your account's default identity.
Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'ys-linux@ubuntu.(none)')
ys-linux@ubuntu:~/Documents/pc_simulator$ git config --global user.email "ys@qq.com"
ys-linux@ubuntu:~/Documents/pc_simulator$ git config --global user.name "ys"
ys-linux@ubuntu:~/Documents/pc_simulator$ git commit -m "<base> <first commit>"
[master (root-commit) 12d5763] <base> <first commit>
files changed, insertions(+)
create mode .cproject
create mode .gitignor
.............................................................

然后将代码上传

ys-linux@ubuntu:~/Documents/pc_simulator$ git status
On branch master
nothing to commit, working directory clean
ys-linux@ubuntu:~/Documents/pc_simulator$ git log
commit 12d57637f6243951d888fa2
Author: ys <ys@qq.com>
Date: Wed May :: - <base> <first commit>
ys-linux@ubuntu:~/Documents/pc_simulator$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name. Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch. See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git) fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use git push --set-upstream origin master ys-linux@ubuntu:~/Documents/pc_simulator$ git push --set-upstream origin master
Username for 'http://192.168.11.222': ys
Password for 'http://ys@192.168.11.222': *********
...............................

获取根密钥

ys-linux@ubuntu:~/Documents/pc_simulator$ ssh-keygen 

ys-linux@ubuntu:~/Documents/pc_simulator$ cat ~/.ssh/id_rsa

-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAo59EMzaF8H3p8u/Ad21xm9kAHatj82Dt5G2Cl0teDibTX/IP
THAynvHKCVX+khgBJuXaAAc1rij***********8y67ZvPfMqKb9YeURw69c
lnudgUmnvWuwqnTvptwsnsI9DdddILAaTr6zWMzu7jiX1Xr67pqUbaq3utAKb8v/
d1/frf4FZu1jAY3K1ST7fsj/f6rTOLm3Z/iM8SZoOuvYBnhsFjy2LC3E0NHzpN+S
wt7HssG9BAYSjSOlLYUEy+EocF**************b96ErNtiNezgzeKsBXk49CmQ
Qoa16Rg6pxs1GhQmdJ8YPzBQLoGRz+M8jrzI2wIDAQABAoIBAGCmW2rE8ik0t1TB
An7g/z2fU31HyGBQq6hqS8oxyjJt1ngVUcb3bWutF12X16DXFDYYV1aSa7oW7iIJ
ZkpuPwKBgQDK*****************************x2ZuuprQBHaiOCdWCT0gHA9
2qr4HRvJF5RTSv/ukct2azlpPvdq0Au5WX/t+N9KjBx7IE9AkXi1K6RtvflsUui8
cIuohVQGC54FxrHda6SU22XEcPcueyoq5Pzs55qdVi9VHAe0ziTRoQ==
-----END RSA PRIVATE KEY-----

将获取的根密钥贴在git网站上

贴上网站后

ys-linux@ubuntu:~/Documents/pc_simulator$ cat ~/.ssh/id_rsa.pub 

ys-linux@ubuntu:~/Documents/pc_simulator$ git config --global push.default simple

ys-linux@ubuntu:~/Documents/pc_simulator$ git remote remove origin

ys-linux@ubuntu:~/Documents/pc_simulator$ git remote -v

ys-linux@ubuntu:~/Documents/pc_simulator$ git remote add origin git@192.168.11.222:ys/kcsdr_ui.git  -----这里写你上传的本地服务器的地址

ys-linux@ubuntu:~/Documents/pc_simulator$ git remote -v

然后可以正常使用git了

更新代码

git add .

更新提示信息

git commit -m "<update>"

抓取已经存在的代码

git pull

上传本地的代码

git push

git 服务器 LINUX端的使用的更多相关文章

  1. (转)初学Git及简单搭建git服务器和客户端

    终于搞定,mac自己作为git服务器,mac也是客户端,如何免登 从另外一个linux服务器的上传公钥得到提示 ssh-copy-id -i ~/.ssh/id_rsa.pub git@192.168 ...

  2. git-搭建企业git服务器

    1.安装 yum install git 2.增加用户 useradd git -d /home/git -g git 3.查看公钥鉴权文件是否存在  cat /home/git/.ssh/autho ...

  3. 搭建Git服务器及本机克隆提交

    前文 Git是什么? Git是目前世界上最先进的分布式版本控制系统. SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首 ...

  4. 在 Linux 下搭建 Git 服务器

    环境: 服务器 CentOS6.6 + git(version 1.7.1)客户端 Windows10 + git(version 2.8.4.windows.1) ① 安装 Git Linux 做为 ...

  5. Linux Ubuntu搭建git服务器

    1. 安装 openssh-server ,用于创建SSH服务. sudo apt-get install openssl-server 使用命令ps -e|grep ssh,查看ssh服务是否启动. ...

  6. 在LINUX上创建GIT服务器【转】

    转自:http://blog.csdn.net/xiongmc/article/details/9176785 如果使用git的人数较少,可以使用下面的步骤快速部署一个git服务器环境. 1. Cli ...

  7. 在 Linux 下搭建 Git 服务器(yum安装)

    服务端(linux): 1. 安装git [root@localhost ~]# yum -y install git 2. 增加一个git账户 为了管理的方便,在linux下面增添一个 " ...

  8. 阿里云 linux搭建git服务器

    git是非常方便的版本控制工具,目前网上有很多免费的git仓库可以给我们使用,但是有些时候我们并不放心将我们的项目寄放在别人的服务器上,这个时候就需要自己搭建一个git服务器. 在linux上面搭建g ...

  9. Windows/Linux 环境搭建Git服务器 + vs2012集成git

    1. 下载.安装Git 我的系统是Windows 7,需要安装Git for Windows. 下载地址: http://code.google.com/p/msysgit/downloads/lis ...

随机推荐

  1. Python基础:数据类型-列表与元组(6)

    Python中数据结构主要有序列.集合和字典. 1. 通用序列操作 Python内置了多种序列,其中最常用的两种:列表和元组.另一种重要的序列是字符串. 列表和元组的主要不同在于:列表是可以修改的,而 ...

  2. 快速去水印(win10换图3D工具)

    之前抠图都用ps啥的,后来发现win10自带的工具画图3D可以直接扣简单的图案,达到去水印的效果 1.将图片放入软件中 2.使用神奇选择工具,调整大小,框出图标 3.点击下一步,将没选上的或选多的进行 ...

  3. MT【332】椭圆正交变换

    (2018河南数学联赛解答10) 已知方程$17x^2-16xy+4y^2-34x+16y+13=0$表示椭圆,求它的对称中心和对称轴. 解:设对称中心为$(a,b)$,显然$A(1,1),B(1,- ...

  4. chrome主页篡改解决方法

    网上有一个超级细致的小白教学连接,但是发现很难找到,分享一下:https://arlenluo.github.io./2017/03/12/DefeatYourBrowser 还有一种情况是要打开 & ...

  5. Vue状态管理之Vuex

    Vuex是专为Vue.js设计的状态管理模式.采用集中存储组件状态它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化. 1.首先让我们从一个vue的计数应用开始 ...

  6. C语言 变量的作用域和生命周期(转)

    转自 https://blog.csdn.net/u011616739/article/details/62052179 a.普通局部变量 属于某个{},在{}外部不能使用此变量,在{}内部是可以使用 ...

  7. JGUI源码:响应式布局简单实现(13)

    首先自我检讨下,一直没有认真研究过响应式布局,有个大致概念响应式就是屏幕缩小了就自动换行或者隐藏显示,就先按自己的理解来闭门造车思考实现过程吧. 1.首先把显示区域分成12等分,bootstrap是这 ...

  8. 五十九、linux 编程—— I/O 多路复用 fcntl

    59.1 介绍 前面介绍的函数如,recv.send.read 和 write 等函数都是阻塞性函数,若资源没有准备好,则调用该函数的进程将进入阻塞状态.我们可以使用 I/O 多路复用来解决此问题(即 ...

  9. PHP数组函数详解大全

    一.数组操作的基本函数 数组的键名和值 array_values($arr);获得数组的值 array_keys($arr);获得数组的键名 array_flip($arr);数组中的值与键名互换(如 ...

  10. 关于dfs

    DFS 关于dfs,我的理解就是深度搜索,找到所有与入口相连的路径,可以用于迷宫求出口,利用递归的思想,进行搜索返回所有值. 比如,给你两个值分别表示迷宫的长和宽,迷宫有一个入口,一个出口,判断能否从 ...