git创建远程仓库并推送本地项目到远程仓库

转载

原文地址:http://blog.csdn.net/ganggexiongqi/article/details/7049914

There is a great deal of documentation and many posts on Git out there, so this is more of a note to self as I keep forgetting the steps needed to set up a remote repository and doing an initial “push”.

So, firstly setup the remote repository:


ssh git@example.com
mkdir my_project.git
cd my_project.git
git init --bare
git update-server-info # If planning to serve via HTTP
exit

On local machine:


cd my_project
git init
git add *
git commit -m "My initial commit message"
git remote add origin git@example.com:my_project.git
git push -u origin master

Done!

在本地仓库添加一个远程仓库,并把本地仓库master分支跟踪到远程分支

  1. $ git remote add origin ssh://xxx@192.168.1.32/~/workspace/code_celloct/gittest  
  2. $ git push origin master  

 

posted @ 2017-03-30 09:46  远洪  阅读(317)  评论(0)    收藏  举报