Can't perform git push/fetch/pull from Command Window
Show older comments
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 Comments
Mario Malic
on 6 Sep 2020
Edited: Mario Malic
on 6 Sep 2020
I don't think that !git status checks the connection with the repository.
Maybe you should try with this
!git push master /origin/master
Adib Yusof
on 6 Sep 2020
Mario Malic
on 6 Sep 2020
Edited: Mario Malic
on 6 Sep 2020
Actually your command is correct.
!git push origin master
I made a test repository and i managed to push it there with this, but I set it up as a project in MATLAB.
You can try to set the repository URL from Remote button, and try to use then the command.
Edit:
- Check if your RSA key is in .ssh directory
- See if you get your repository links by this command
!git remote -v
- Maybe change the commit mail to match the one in your account
!git config --global user.email "email@example.com"
Lastly, try this command https://docs.github.com/en/github/authenticating-to-github/testing-your-ssh-connection
Adib Yusof
on 7 Sep 2020
Mario Malic
on 7 Sep 2020
The last thing to suggest is to re-do again this guide https://ch.mathworks.com/help/matlab/matlab_prog/set-up-git-source-control.html
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!