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

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

创建仓库

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

git init --bare sample.git

克隆远程仓库到本地

git clone [email protected]:/home/git/sample.git

已有项目,绑定远程仓库

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

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

# 绑定远程仓库
git remote -add origin [email protected]:/home/git/sample.git

推送

# 查看本地更改
git status

# 添加更改
git add -u

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

# 推送
git push origin master

拉取

git pull origin master

你可能感兴趣的:(git,服务器,运维)