Can't perform git push/fetch/pull from Command Window

조회 수: 53 (최근 30일)
Adib Yusof
Adib Yusof 2020년 9월 6일
편집: Mario Malic 2020년 9월 23일
I'm not familiar with Git or GitHub before; my first introduction to these tools are by the integration with MATLAB. I set it up and works well when performing actions through interface (right click on the Current Folder > Source Control > [Action]). I have also set up SSH key so that I don't have to enter my username and password everytime I want to push/fetch/pull. To make the process easier, I want to be able to perform actions through Command Window by starting the command with:
!git ...
However, all actions that require communication with the remote failed, for example:
!git push origin master
What can I do to fix this problem? Thank you!
  댓글 수: 5
Adib Yusof
Adib Yusof 2020년 9월 7일
Thank you so much for taking time to suggest solutions. I have tried all of them, unfortunately, I was not succesful. I reckon it must have to do my laptop specifically. Until I figure this out, I will continue using the interface to execute git commands. Again, thanks!

댓글을 달려면 로그인하십시오.

채택된 답변

Mario Malic
Mario Malic 2020년 9월 12일
편집: Mario Malic 2020년 9월 23일
Try this as well, this might be the actual solution.
Replace 'username' and 'your-repository'
!git remote set-url origin git@github.com:username/your-repository.git
This will enable you to do do what you want, I had the same issue and this what's fixed it.
In case you commit and push from command window and end up with an error such as this,
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
% Open Git Bash
system('"C:\Program Files\Git\git-bash.exe"'); %wherever is located
%your project path should be current dirrectory, type
git push
% and close Git Bash
Also, commit button from toolbar ignores -S option (GPG signed) in global config.
  댓글 수: 3
Mario Malic
Mario Malic 2020년 9월 12일
Glad it did, I learned a little bit about this stuff as well!
Adam Danz
Adam Danz 2020년 9월 13일
+1, me too!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Source Control에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by