git仓库与项目源码分离

  • 在服务器上初始化git仓库
cd 
mkdir gitrepo
cd gitrepo
git init --bare runoob.git
  • 本地

若是已经有git项目了,直接添加一个仓库地址就行了

git remote add remote_git xxx@remotegpu.net:/home/xxx/gitrepo/runoob.git

如果在同一个机器上,则

git remote add remote_git /home/xxx/gitrepo/runoob.git

几个相关的命令:

# 查看关联的远程仓库的名称
git remote

# 查看关联的远程仓库的详细信息
git remote -v

# 添加新的远程仓库关联
git remote add <name> <url>

# 删除关联的远程仓库
git remote remove <name>
原文地址:https://www.cnblogs.com/hejunlin1992/p/11898228.html