GIT命令从另一台远程计算机

时间:2017-07-11 05:55:16

标签: git github

我想从我的GIT克隆一个repo到一个远程服务器,并通过命令行我想创建一个分支并进行更改并将此分支添加到repo。我从我的系统访问该远程服务器 我使用了以下命令。

git clone <remote address of repo> <server local address>
cd <repository>
checkout <particular branch> or
checkout -b <new branch> under master
<<<<<<<made changes>>>>>>>>>>
now what ? to make these changes available to remote repository.

我有这个存储库可用。 现在应该创建分支并进行更改并将此分支添加到克隆的repo中的正确顺序。并创建拉取请求。

1 个答案:

答案 0 :(得分:0)

git依靠外部标准工具(例如ssh或现有的http服务器)进行网络通信。

在远程服务器上运行操作git操作的标准方法&#34;很简单:

  • 登录远程服务器(例如:使用ssh)
  • 执行操作

例如:

  • 要在远程主机上创建repo的克隆:

    local$ ssh remote
    remote> cd /target/directory/
    remote> git clone ssh://local/repo  # <- or whatever url accessible from remote
    
  • 结帐给定的提交:

    # interactively :
    local$ ssh remote
    remote> cd /target/directory/repo && git checkout [branch]
    
    # batch mode :
    local$ ssh remote 'cd /target/directory/repo && git checkout [branch]'
    
  • 拉变化:

    # interactively :
    local$ ssh remote
    remote> cd /target/directory/repo && git pull
    
    # batch mode :
    local$ ssh remote 'cd /target/directory/repo && git pull'
    
  • 等...