搭建git服务器(本地局域网)

默认系统已经添加了git用户

创建仓库

(假定在/home/git目录下创建仓库)

git init --bare sample.git

克隆远程仓库到本地

git clone git@192.168.0.100:/home/git/sample.git

已有项目,绑定远程仓库

# 查看远程仓库绑定
git remote -v

# 解除远程仓库绑定
git remote remove origin

# 绑定远程仓库
git remote add origin git@192.168.0.100:/home/git/sample.git

推送

# 查看本地更改
git status

# 添加更改
git add -u

# 提交更改
git commit -m "提交说明"

# 推送
git push origin master

拉取

git pull origin master
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐