简体   繁体   中英

How to clone a git-project to create a different repo?

I've got a Github project ( https://github.com/gbrits/yeoman-less ) that I'd like to use as a quickstart for some other projects. Each of these other projects need to get their own repo.

So git clone https://github.com/gbrits/yeoman-less (alone) doesn't work, since I need to do something like change the origin after the clone to point to a different remote endpoint.

Related: hos would you create a remote origin in github from the commandline, instead of having to manually create it and then linking it up in the commandline?

Pretty easy it appears.

First clone

git clone git://..

Optionally change name of local dir.

intermezzo : create new remote github repo (from website) or from command-line (see below): (from Is it possible to create a remote repo on GitHub from the CLI without opening browser?

curl -u 'USER:PASS' https://api.github.com/user/repos -d '{"name":"REPO"}'
git remote add origin git@github.com:USER/REPO.git
git push origin master

Change origin

git remote set-url origin git://<new repo>

And push

git push -u origin master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM