将本地的working copy复制到新的repo

因为git@git.yonyou.com:iuap_ap/web_webap.git不让我read/write,从其他电脑上复制了带有.git的副本,然后上传到自己在coding.net中建立的私有仓库。

chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git tag -l
bgy_iwebap_20160622
tag_WEB_merge_6.5.0.00_20151222
tag_WEB_merge_6.5.0.00_20160118
tag_WEB_release_6.5.0.00_20151227
tag_WEB_release_6.5.0.00_20160229
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git branch 
  develop
* develop_query
  developold
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git remote -v
origin	git@git.yonyou.com:iuap_ap/web_webap.git (fetch)
origin	git@git.yonyou.com:iuap_ap/web_webap.git (push)
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git remote add new-origin git@git.coding.net:xin2011nix/web_webap.git
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git remote -v
new-origin	git@git.coding.net:xin2011nix/web_webap.git (fetch)
new-origin	git@git.coding.net:xin2011nix/web_webap.git (push)
origin	git@git.yonyou.com:iuap_ap/web_webap.git (fetch)
origin	git@git.yonyou.com:iuap_ap/web_webap.git (push)
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git status
On branch develop_query
Your branch is up-to-date with 'origin/develop_query'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   .classpath
	modified:   .gitignore
	modified:   .project
	modified:   iwebap/src/public/uap/iweb/bt/filter/BtFilter.java
	modified:   iwebap/web/css/style.css
	modified:   iwebapadapt65/src/public/uap/iweb/print/util/PrintFileServiceUtil.java
	modified:   iwebapadapt65/src/public/uap/iweb/pub/query/VOMetaConvertor.java
	modified:   iwebbilltemplate/src/public/uap/iweb/bt/Bt2Html.java
	modified:   iwebbilltemplate/src/public/uap/iweb/bt/RenderVariable.java
	deleted:    iwebbilltemplate/web/hyext/说明.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	iwebbilltemplate/web/hyext/╦╡├ў.txt
	iwebbilltemplate/web/js/iwebcheck.js

no changes added to commit (use "git add" and/or "git commit -a")
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git push --all new-origin
Counting objects: 8080, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3121/3121), done.
Writing objects: 100% (8080/8080), 2.75 MiB | 825.00 KiB/s, done.
Total 8080 (delta 4440), reused 7250 (delta 3874)
To git@git.coding.net:xin2011nix/web_webap.git
 * [new branch]      develop -> develop
 * [new branch]      develop_query -> develop_query
 * [new branch]      developold -> developold
chenyang@chenyang-pc:~/source/_uap_deps_/web_webapnew__160708$ git push --tags new-origin
Counting objects: 32, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (32/32), 3.11 KiB | 0 bytes/s, done.
Total 32 (delta 17), reused 22 (delta 8)
To git@git.coding.net:xin2011nix/web_webap.git
 * [new tag]         bgy_iwebap_20160622 -> bgy_iwebap_20160622
 * [new tag]         tag_WEB_merge_6.5.0.00_20151222 -> tag_WEB_merge_6.5.0.00_20151222
 * [new tag]         tag_WEB_merge_6.5.0.00_20160118 -> tag_WEB_merge_6.5.0.00_20160118
 * [new tag]         tag_WEB_release_6.5.0.00_20151227 -> tag_WEB_release_6.5.0.00_20151227
 * [new tag]         tag_WEB_release_6.5.0.00_20160229 -> tag_WEB_release_6.5.0.00_20160229

如果旧的repo不用了,可以删除,然后改名

# Remove "old repo" remote:
git remote rm origin

# Rename "new repo" remote into just 'origin':
git remote rename new-origin origin

ref: https://gist.github.com/manakor/8972566