设置一个git远程原点 [英] Setting up a git remote origin

查看:82
本文介绍了设置一个git远程原点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下回购。


  1. DEV REPO:在我的开发机器上的一个目录中进行更改

  2. MAIN REPO:我的开发计算机上裸露的存储库,我从dev repo推送更改

  3. PRODUCTION REPO:主机上的存储库以从主repo中提取更新

我用 git remote add origin / Users / me / sites / main_repo 来设置主回购作为DEV回购的来源。 PRODUCTION repo在远程主机上。我是否可以使用同一命令的变体将MAIN回购作为PRODUCTION回购的来源?如果是,那么我想这个语法会包含一个IP地址。使用SSH

使用SSH

  

解决方案

> git remote add origin ssh:// login @ IP / path / to / repository

使用HTTP

  git remote add origin http:// IP / path / to / repository 

code>

然而,作为一个部署过程,有一个简单的 git pull 通常是一个 bad idea ,应该避免使用真正的部署脚本。


I have the following repos.

  1. DEV REPO: in a directory on my development machine where i make changes
  2. MAIN REPO: bare repository on my development machine to which i push changes from dev repo
  3. PRODUCTION REPO: repository on host machine to pull updates from the main repo

I used git remote add origin /Users/me/sites/main_repo to set the MAIN repo as origin for the DEV repo. The PRODUCTION repo is on a remote host. Can i use a variation of the same command to set the MAIN repo as origin for the PRODUCTION repo also? If "yes", then i suppose the syntax would include an ip address. What would that look like?

解决方案

Using SSH

git remote add origin ssh://login@IP/path/to/repository

Using HTTP

git remote add origin http://IP/path/to/repository

However having a simple git pull as a deployment process is usually a bad idea and should be avoided in favor of a real deployment script.

这篇关于设置一个git远程原点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆