简体   繁体   English

第一次将本地git分支推送到远程服务器

[英]Push a local git branch to remote server for the first time

I have used git for a long while now at various places of work but never had to set a project up to use git and I'm struggling to understand how, and execute successfully... 我已经在各个工作场所使用git很长一段时间但是从来没有设置过使用git的项目,我很难理解如何,并且成功执行......

I have a local folder which is a git repo: 我有一个本地文件夹,这是一个git repo:

c:\myDir\MyProject

I have a Linux server(with git installed) where I want push the local repo/site to, but I'm unsure how to create the bridge between them. 我有一个Linux服务器(安装了git)我想要推送本地repo / site,但我不确定如何在它们之间创建桥接器。

I read that on my server I need to go into a dir that will hold the repo and do 我在服务器上看到这个,我需要进入一个可以保存回购的目录

git init --bare

But then what? 但那又怎样? How do I create the bridge to push from local and pull from remote? 如何创建从本地推送并从远程拉出的桥?

I've tried (from local): 我试过(从当地):

git remote add origin ssh://myUrl.com

but then git push origin master gives fatal: No path supplied which I know is because I set it up wrongly 但是然后git push origin master fatal: No path supplied我知道是因为我错误地设置了它

Can anyone offer basic direction so I can get started? 任何人都可以提供基本方向,所以我可以开始吗?

添加远程时,而不是仅命名服务器,您必须在服务器上提供包含Git存储库的文件夹的完整路径,即您在其中执行git init --bare的文件夹(例如/path/to/git-repo

git remote add origin user@example.com:/path/to/git-repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM