分享

git 增加远程库

 ala咪s 2014-03-22
 

git添加已存在工程到github远程版本库

分类: git 177人阅读 评论(0) 收藏 举报

首先,在github上建立远程版本库https://github.com/mygit/testgit.git

将本地工程添加到远程版本库中去

git init										//	初始化git环境
git config --global user.name 'name'			//	配置用户名,以便于远程提交
git config --global user.email xxx@xxx.xxx		//	配置用户邮箱,以便于远程提交

git add .										//	添加所有文件
git commit -m 'commit'							//	提交到本地库

git	remote add nickname	https://github.com/yourgit/testgit.git	//	添加远程版本库
git	push nickname master						//	将本地master分支提交到远程分支

git remote show nickname						//	显示远程信息
如果出现”Updates were rejected because the tip of your current branch is behind“错误,则说明github上的readme与本地版本冲突,可以执行如下语句强行提交

git push -u nickname master -f

从git上获取最新版本代码的命令为

git clone -b branchname username@https://github.com/yourgit/testgit.git

更多0

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多