简体   繁体   中英

Cloning from Microsoft Azure to local git repository

I apologize if this is such a newbie question, but I am new to Git and source control in general. Any sort of help would be highly appreciated.

I created a Django web application on Microsoft Azure (following this tutorial), created a local repository on my computer (following this tutorial), and tried to clone the python files from Azure to my local repository, but I always end up copying the contents of my local repo into itself instead.

These were the commands I used, in this order:

cd <local_repository>
git init
git add README.txt
git commit -m "Adding README.txt to the repository"
git remote add azure <git_url_azure>
git push azure master
git clone <git_url_azure>

I need to clone the contents of my Django application into my local repository so I can open the Visual Studio solution from there and get coding. The solution must be pretty simple but I can't find answers on the internet. What should I do?

You need to use only git clone repository command. What you are trying to do is not the cloning, but instead of that a whole bunch of different actions.

You just need to clone the repository (Each repository can be used as a source). For example:

git clone <git_url_azure> my_dir

You may need to change the origin remote branch afterwards.

However, you may also need to create a clone in which you can push from other directories (Like a backup). In this case you need to create a "bare" directory, ie a directory that contains only the database but is not populated:

git clone --bare my_dir

This will permit creating a clone based on it:

git clone my_dir my_new_dir
cd my_new_dir
... (Some modifications, commits, branches...)
git push origin

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