git将现有项目上传到git仓库

前提,本地有一个项目guard,可以通过ssh远程登录到git服务器,需要将本地项目上传到git服务器,假设git服务器地址为192.168.0.5,仓库在git账户根目录下

1、ssh连接到git服务器,ssh [email protected]

在仓库目录下,输入命令,在仓库中创建空的项目:

git init --bare guard.git

2、在本地guard目录下,依次执行命令:

git init

git add .

git commit -m "initial project"

//添加本地项目到远程

git remote add origin ssh://[email protected]~/guard.git

//上传本地项目作为master到git服务器

git push origin master

 

猜你喜欢

转载自wangzt-2008.iteye.com/blog/2192187
今日推荐