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.
習慣沉默2017-05-02 09:47:12
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> <自定义的仓库名字>