git repo code example
Example 1: set up git repository
# New local repository
git init
git add .
git commit -m "Initial commit"
# New remote repository
# Create remote repository (likely on github), then:
git remote add origin https://github.com/username/new_repo #https
git remote add origin git@github.com:username/new_repo #ssh
# Now push
git push -u origin master
Example 2: how to download a git repository
git clone "then thing you can copy with https"
Example 3: git init then how to get url
below is used to a add a new remote:
git remote add origin git@github.com:User/UserRepo.git
below is used to change the url of an existing remote repository:
git remote set-url origin git@github.com:User/UserRepo.git