github - git command line, how to synchronize an existing local directory with a remote repository with a different name
怪我咯
怪我咯 2017-05-02 09:45:12
0
3
745

For example, if there is a directory aaa locally, and a warehouse named bbb has been established on remote github, how do I establish a synchronization relationship? --Is it possible not to change the directory name locally?

The stupid method I am using now is to use git clone **/bbb.git to the local, and then copy the files in aaa into the bbb warehouse, and then synchronize. This must change the directory name. And troublesome.

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
phpcn_u1582

Passedgit remote add命令增加远程仓库。
git remote add origin **/bbb.git

習慣沉默

You don’t have to change the directory name, just use the following command in the local warehouse aaa:

git remote add origin <远程仓库的url>

Hereorigin是远程仓库url的别名,可以使用比较常用的origin, you can also specify it freely. One thing to note is that if the remote warehouse already has content, it will be more troublesome. Therefore, when building a remote warehouse, it is best not to add any README, LICENSE and other files, otherwise it will cause the local to be unable to be pushed to the remote, because the two have no common history.

In addition, if the original poster’s method is feasible, you can also customize the warehouse name when using the git clone command:

git clone <远程仓库url> <自定义的仓库名字>
伊谢尔伦

git remote add origin -u **/bbb.git

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template