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.
Passed
git 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:
Here
origin
是远程仓库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 remote add origin -u **/bbb.git