Wednesday, December 27, 2023

How to push from local repo to remote ?

 push  from local repo to remote



PS C:\git-lab\demo1> git remote -v

origin  https://github.com/anuragkumarjoy/terraform-code.git (fetch)

origin  https://github.com/anuragkumarjoy/terraform-code.git (push)

PS C:\git-lab\demo1>

PS C:\git-lab\demo1>




PS C:\git-lab\demo1> git push origin master

Enumerating objects: 5, done.

Counting objects: 100% (5/5), done.

Writing objects: 100% (3/3), 282 bytes | 282.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

To https://github.com/anuragkumarjoy/terraform-code.git

   ae8129e..ea488b5  master -> master

PS C:\git-lab\demo1> 

PS C:\git-lab\demo1>




git push -f origin master (also work )

How to add git remote origin ?

 Add  git remote origin 


PS C:\git-lab\demo1> git remote -v

PS C:\git-lab\demo1> 

PS C:\git-lab\demo1>

PS C:\git-lab\demo1> git remote add origin https://github.com/anuragkumarjoy/terraform-code.git

PS C:\git-lab\demo1> 

PS C:\git-lab\demo1>

PS C:\git-lab\demo1> git remote -v

origin  https://github.com/anuragkumarjoy/terraform-code.git (fetch)

origin  https://github.com/anuragkumarjoy/terraform-code.git (push)

PS C:\git-lab\demo1>

PS C:\git-lab\demo1>

How to remove remote origin in git ?

 Remove git remote origin



PS C:\git-lab\demo1> git remote -v

origin  https://github.com/anuragkumarjoy/terraform-code.git (fetch)

origin  https://github.com/anuragkumarjoy/terraform-code.git (push)

PS C:\git-lab\demo1>

PS C:\git-lab\demo1>


PS C:\git-lab\demo1> git remote remove origin

PS C:\git-lab\demo1> 

PS C:\git-lab\demo1>

PS C:\git-lab\demo1> git remote -v

PS C:\git-lab\demo1> 

PS C:\git-lab\demo1>


Git push Error - fatal: credential-cache unavailable; no unix socket support

PS C:\git-lab\demo1>

PS C:\git-lab\demo1> git push --set-upstream origin master

fatal: credential-cache unavailable; no unix socket support

Everything up-to-date

branch 'master' set up to track 'origin/master'.

PS C:\git-lab\demo1>


PS C:\git-lab\demo1> 

PS C:\git-lab\demo1> git config --global --unset credential.helper

PS C:\git-lab\demo1> 



PS C:\git-lab\demo1> git push --set-upstream origin master

Everything up-to-date

branch 'master' set up to track 'origin/master'.

PS C:\git-lab\demo1>

PS C:\git-lab\demo1>

PS C:\git-lab\demo1>