Assign Remote for Git Push

I have been developing in the local repository for some time and just setting up the git server.

In the past, when the remote repo already exists, I can do it git clone, and then the future one git pushjust works - it looks like it is associated with the remote that is being git cloneretrieved.

Since I want to direct all my existing work to this new remote, I did git remote add foo. But git pushstill not working, I have to do git push foo master.

How do I make foo masterdefault to git pushwork on it? And secondly, have I approached this correctly? How would you fill out a new remote repo with an existing local repo?

+3
source share
3 answers

, git push - , foo origin.

+2

git push origin, git clone, . , git , ; .git/config . , (, [branch "master"], ) remote = origin remote = foo

+1

You need to set the remote source url:

git config --get remote.origin.url
git config --edit
0
source

Source: https://habr.com/ru/post/1777849/


All Articles