git命令

一:将本地的代码push到一个干净的服务器仓库中
	git init
	git add *
	git commit -m "initialized"

	把仓库推送到服务器
	 git push origin master 
	 
	 git push http://192.168.0.172:9080/gp_iot/project_iot.git
	 
	 
	fatal: The current branch master has no upstream branch.
	To push the current branch and set the remote as upstream, use

	git push --set-upstream http://192.168.0.172:9080/gp_iot/project_iot.git master
		
二: clone master分支代码:(下面的两条命令都正确)
	git clone http://192.168.0.172:9080/gp_iot/project_iot.git 
	git clone http://192.168.0.172:9080/gp_iot/project_iot.git master


三: clone develp分支代码:

	错误用法:(clone下来的还是master,不是develp)
	git clone http://192.168.0.172:9080/gp_iot/project_iot.git develop  

	正确:
	先: git clone http://192.168.0.172:9080/gp_iot/project_iot.git 
	再到clone下来后的目录内执行命令:
	git checkout -b develop origin/develop
	再看代码就是分支的代码了。
	
	
	
	
git init
git add *
git commit -m "initialized"


git push --set-upstream 仓库地址 master

git branch develop

git branch

git checkout develop

git push  仓库地址 develop:develop




------------------------------
git push --set-upstream http://192.168.0.118:9080/gitlab/cmup-bd/cmup-doc-bd.git master


git branch develop

git branch

git checkout develop

git push  http://192.168.0.118:9080/gitlab/cmup-bd/cmup-doc-bd.git develop:develop


------------------------------
git push --set-upstream http://192.168.0.118:9080/gitlab/cmup/cloud-config.git master
git branch develop

git branch

git checkout develop

git push  http://192.168.0.118:9080/gitlab/cmup/cloud-config.git develop:develop



------------------------------------------------
git init
git add *
git commit -m "initialized"

git push --set-upstream http://192.168.0.118:9080/gitlab/cmup-bd/cmup-clearing-spark.git master
git branch develop

git branch

git checkout develop

git push http://192.168.0.118:9080/gitlab/cmup-bd/cmup-clearing-spark.git develop:develop

  

原文地址:https://www.cnblogs.com/dqh123/p/12073053.html