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

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 [email protected]:/home/george/git/git_learn/project.git ( here please confirm the remote repository has write access )

$ git push origin master

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

时间: 2024-07-29 12:43:25

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

github新建本地仓库并将代码提交到远程仓库

方式一: 在github上新建好仓库:gitTest 使用命令git clone [email protected]:yourgithubID/gitTest.git,克隆到本地相应的位置 将要上传的工程代码拷贝到本地的gitTest仓库中 使用如下命令来将其提交到远程仓库中 git add * git commit -m "some info" git push origin master 缺点:需要拷贝,如果提交的工程代码永远不再改变,可以使用该方式,但是如果代码还需要修改再提交,

git本地提交到远程仓库命令

创建好远程仓库,然后要从本地上传代码到远程仓库: 1.git init 初始化git本地仓库 2. git add 添加到暂存区 3. git commit -am "提交备注" 4. git remote add origin [email protected]:xxx.git  添加git远程仓库地址 5. git  push origin master:origin/master  推送本地到远程分支

本地分支和远程分支的创建与合并

创建本地分支.提交到远程分支 常用指令 $ git remote -v //可以查看你当前项目的远程git地址 $ git status //查看当前代码状态,改动,所在分支,当前状态有没有代码冲突等 $ git branch -a //就是查看远程的所有分支列表了, $ git branch //是查看本地的git分支.绿色代表当前项目所在的分支,红色就是远程分支列表. $ git branch -d test //删除分支 $ git checkout test//切换分支 $ git pu

git创建版本库以及使用

Git使用教程(摘自tugenhua0707) 一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首先要从中央服务器哪里得到最新的版本,然后干活,干完后,需要把自己做完的活推送到中央服务器.集中式版本控制系统是必须联网才能工作,如果在局域网还可以,带宽够大,速度够快,如果在互联网下,如果网速慢的话,就纳闷了. Git是分布式版本控制系统,那么它就没

Eclipse使用git提交本地项目到远程git仓库

1.创建了本地git仓库: 右键项目——Team——share ——Create Repository——finish   2.将项目提交到本地仓库然后提交到远程git仓库 右键项目——Team——commit and push   3.填写git的https地址和账户 4.Source ref和Destination ref选择refs/heads/master——Add Spec——勾选force update,不然提交空内容 Done

使用git初始化本地仓库并提交到远程分支

创建本地文件并提交到github远程分支,步骤如下: 1.通过github创建repository,本例中repository名称为maven_demo,工程为maven + spring + mybatis集成小demo,有兴趣的童鞋可以瞅瞅,github地址为https://github.com/smileLuckBoy/maven_demo.git 2.在项目根目录下添加文件.gitignore,内容为无需添加版本控制的文件列表,具体语法大家自行百度即可哦,示例如下: *.classpat

Git基础教程(建库,并将本地文件提交到远程github仓库)

说明: 1.本教程远程仓库使用的是github 2.全命令行操作 3.以下某些文件夹名称为".XX",此类文件夹在windows中默认是隐藏文件,需要打开设置才能显示出现 具体步骤为[打开资源管理器-工具-文件夹选项-导航窗格-勾选"显示所有文件夹"] 正文: 1.软件准备 ①下载并安装客户端. 百度"Git",根据系统类型自行下载相应版本并安装(点击此处直达),以下教程为windows版本 ②打开客户端. 任意目录右击鼠标,选择"Gi

Git下创建项目、添加描述并将本地项目关联远程仓库和上传

1.通过OSChina中创建项目 2.创建完成项目后,我想为项目加上相当详细的说,并且有截图,这样其实也很简单只需要添加一个 README.md文件就可以了.请点击此处输入图片描述 在里面你可以添加详细的描述,也可以上次图片.瞧下图效果 3.接下来我想将Git中的项目和本地项目关联 在源代码项目目录执行命令 git init,初始化一个空的git项目 接下俩执行git status 就可以看到很多新增的文件了 然后执行git add . / git add -A /git add 指定某个文件或

Git 创建远程仓库并克隆到本地,创建本地仓库并推送到远程仓库

配置用户信息 配置的是你个人的用户名称和电子邮件地址.这两条配置很重要,每次 Git 提交时都会引用这两条信息,说明是谁提交了更新,会随更新内容一起被永久纳入历史记录 git config --global user.name "testerDong" git config --global user.email "[email protected]" 1.创建远程仓库,克隆远程仓库到本地 a.先在GitHub上创建一个远程仓库 b.复制该仓库SSH地址 c.git