I create a new repository:
git init
echo "# MESSAGE" >> README.md
git add README.md
git commit -m "first commit"
Then I want to push my commit to the empty remote repository created on github so I have to set remote.
What is difference between using following commands ? :
git remote add origin [email protected]:User/UserRepo.git
git remote set-url origin [email protected]:User/UserRepo.git
At the end I perform push:
git push -u origin master
What happens when I call git remote set-url origin
just after git init
? Does git remote set-url origin
create origin? If origin already exists after git init
there is no difference between using those commands in my scenario, right?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…