git – remote add origin vs remote set-url origin
Stack How?
Stackorigin – The Community of Question and Answers Latest Articles
Read More About Python List Comprehension with examples
Python List Comprehension: Python List comprehension provides a much more short syntax for creating a new list based on the values of an existing list. Advantages of List Comprehension in Python: Time Efficient than loop Space Efficient than loop Needs ...
Do not accept an offer letter from companies.
Do not accept an offer letter from companies without verifying the following points. Designation Salary Details & CTC Distribution Leave Policies Working Hours & Days Medical Coverage/Insurance Probation Period Notice Period Benefits and Perks Bonus F&F Policy
How to call API using Ajax
AJAX stands for Asynchronous JavaScript and XML and its used for to make calls to the server to fetch some data. In this article, we will learn how to implement a simple API call using AJAX technology. How to use GET ...
below is used to a add a new remote:
below is used to change the url of an existing remote repository:
below will push your code to the master branch of the remote repository defined with
origin
and-u
let you point your current local branch to the remote master branch:Below will reinitialize your local repo; also clearing remote repos (ie origin):
Then below, will create ‘origin’ if it doesn’t exist:
Else, you can use the
set-url
subcommand to edit an existing remote:Also, you can check existing remotes with
Hope this helps!
If you don’t have a git repo already initiate one with
git init
git remote -v
Check if any remote already existsgit remote set-url origin git@github.com:User/UserRepo.git
to change the origingit remote add origin git@github.com:User/UserRepo.git
to set new origin for your repo.git push -u origin master
to push your code to remote and add upstream (tracking) reference to your remote branch.NOTE: If you use
-u
flag, its for upstream, it enables you to use simplygit pull
instead ofgit pull origin <branch-name>
in upcoming operations.If you have existing project and you would like to add remote repository url then you need to do following command
if you would like to add readme.md file then you can create it and add it using below command.
make your first commit using below command
Now you completed all local repository process, now how you add remote repository url ? check below command this is for ssh url, you can change it for https.
How you push your first commit see below command :