首页 > 其他 > 详细

git创建远程仓库以及在本地提交到远程仓库的方法

时间:2019-10-05 15:05:22      阅读:65      评论:0      收藏:0      [点我收藏+]

Git create remote repository and usage in the local environment

1. create the remote repository

loggin the server

$ cd ~/git/git_learn/

$ mkdir project.git

$ cd project.git

$ git init --bare

thus there are some files and directories in the directory ‘~/git/git_learn/project.git/‘, just like the following picture

技术分享图片

 

 and then you need to add the write access to this repository, so that you can git push in the local environment

$ cd ~/git/git_learn

$ chmod -R 777 project.git ( significant )

2. In your local environment, open ‘bash‘ shell, and initialize a local repository(git project)

$ cd ~/test

$ mkdir Myproject.git

$ git init

and the next step is to add new file or modify existing file, then commit them

$ vim main.c

$ git add main.c or git add .

$ git commit -s ( confirm the user.name and user.email are correct and available ) or git commit -m "create the project and add main.c"

$ git remote add origin george@10.168.101.104:/home/george/git/git_learn/project.git ( here please confirm the remote repository has write access )

$ git push origin master

git创建远程仓库以及在本地提交到远程仓库的方法

原文:https://www.cnblogs.com/georgemxx/p/11624667.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!