Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在我的服务器上创建Git bare,我是克隆repo还是进行远程添加?_Git - Fatal编程技术网

在我的服务器上创建Git bare,我是克隆repo还是进行远程添加?

在我的服务器上创建Git bare,我是克隆repo还是进行远程添加?,git,Git,我的服务器上有一个只能通过SSH访问的私有git设置 所以我在我的服务器上做了一个git初始化,现在在我的笔记本电脑上,我如何引用它 我是使用git克隆还是其他什么?或多或少,是的。它将在第一个git克隆上显示为一个空的repo。在任何其他git推送开始工作之前,您必须从克隆的repo中执行“git推送原始主机” git clone ssh://username@your-ssh-host/your-repo-location cd $your_repo touch Readme git add

我的服务器上有一个只能通过SSH访问的私有git设置

所以我在我的服务器上做了一个git初始化,现在在我的笔记本电脑上,我如何引用它


我是使用git克隆还是其他什么?

或多或少,是的。它将在第一个git克隆上显示为一个空的repo。在任何其他git推送开始工作之前,您必须从克隆的repo中执行“git推送原始主机”

git clone ssh://username@your-ssh-host/your-repo-location
cd $your_repo
touch Readme
git add Readme
git commit -am "Initial commit"
git push origin master
万岁

(克隆空的裸存储库)已被接受,但这不是唯一的可能性

如果您已经在本地完成了一些工作(创建了一个存储库并提交给它),那么您将使用远程存储库,如问题标题中所述:

git remote add origin <ssh-url>
这将允许您执行类似于
git pull
的操作,隐式地表示
git pull origin master

git branch --set-upstream master origin/master