Git
#View git public repo in code editor view
//From Local to Git
1. Push from the local to git first time
git init
git add .
git commit -m "business creation and product creation feature added"
git branch -M server
git remote add origin https://github.com/iphone201988/skwad.git
git push -u origin main //if not work then
git push origin main -f
2. Push from the local to git from second time:
git add .
git commit -m "business creation and product creation feature added"
git branch -M
git push origin
// From git to server
1. pull on the live server for first time:
git stash //uses: discard local changes
git remote add origin https://github.com/iphone201988/skwad.git
git pull origin main
2. pull on the live server second time:
git stash //uses: discard local changes
git pull origin
error: No such remote 'origin'
remove all git bash using:
rm -R .git
then start with fresh
#Fresh Git from local
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/iphone201988/skwad.git
git push -u origin main
#If we work with team on git: (first setup the project by pull the develop branch) git pull <url>
git pull <url> <specific branch> //pull from specific branch (then.....) git add . git commit -m "message" git pull origin develop git push origin your_branch
#create new branch
git branch new_branch_name
#swith to new created branch git checkout new_branch_name
#set default streem to use only git push: git push --set-upstream origin branch_name
#Change git account in Windows:
you need to open the credential manager of your computer (Win or Mac) and update the credentials there Here is how it look on windows
1. Search for "Credential Manager"
2. Remove the old account from here
3. try again to push the code, you can verify the account easily which you want to use
#Server login in terminal login:
ssh -i 'path_of_pem file' user@ip_address
Example=>
ssh -i '/home/techwinlabs/Downloads/Dutp.pem' ubuntu@18.587.45.69
ssh -i /Downloads/Rewp.pem ubuntu@18.587.45.69
Basic sever login from terminal into any hosting:
ssh user_name@dedicated_ip_address
Example: ssh techmanish@85.65.578.589
Some Basic git Command
CMD
- cls: Clear the screen
- cd folder_name: Change directory
- cd \ : back to root directory
- cd.. : back to directory
- d: = goto d drive
- dir: show all files in directory
- mkdir folder_name: make directory (for creating a new folder)
- systeminfo: all computer details (including Ram, processor, hardware, windows)
0 Comments