Technical Issue: Git hates me and won't let me push my repositories
Asked by Mia Paulin:

[@mention](/t5/user/viewprofilepage/user-id/732788) Good morning all! I have an issue with my git. I've been trying to push a branch of one of my repositories to my remote bitbucket repository, but it's not working. I didn't use the sourceTree GUI to do it, I've been using the terminal and the git cli so that I can get familiar with the commands. I made sure I was in the right directory and pushed the branch the way it said to in the documentation:

cd \~//repos

/\*

to make sure I was in the right directory. I used two forward slashes just in case I was more than one directory above where I needed to be(ie, ., ./)

\*/

git push on-off-premise middle_child

/\*

middle_child is the name of a child branch merged into my master branch(i didn't call it main)

\*/

It keeps saying the remote repository can't read the file. It's telling me to make sure I have permission and that the file exist. I know I have the permissions. I know the file exist. When I look at the remote repository, the one in bitbucket, the branch I'm trying to push isn't there. I tried with files. putting the filename where the branch name was. got error messages. What am I doing wrong?


Answers:
author: Craig Nodwell
body: Hi [@Mia Paulin](/t5/user/viewprofilepage/user-id/5184106)   

cd to your git directory   
git add --all  
git commit -m "jira-id if you have one then your message"  
git push --all \<path to repo\> no branch name here just the path to the repo  
***re:** git push --all <https://mybitbucket.com/myorg/myrepo.git>* **TIP** use the path you get from the clone string.

git push origin usually should work fine but I don't what you have in your git-config so just use the full path back to the repo

comments: author: Mia Paulin
body: [@Craig Nodwell](/t5/user/viewprofilepage/user-id/3973516) So, if I added a remote repository to my home pc using

git remote add \<remote\> \<url\>

can't I just use the name of the remote repository?

git remote add -all \<remote name\>


author: Mia Paulin
body: I mean

/\*

git push -all \<remote\>

\*/


author: Craig Nodwell
body: Yes but not exactly like that :)  
You have to do the add, then the commit, then the push -\> which can use the remote setting.  

You add the files you want(in a GUI client this would be your stagged files).  
You commit those stagged files, this is where you add your commit message.  
You push that commit to the remote, this is where you get your changes into the remote.  

In your repository directory as above.  
The git remote add command takes two arguments:  
* A unique remote name, for example, "my_repo"
* A remote URL, the one you used to clone the repo

After you create it you can verify it with  
git remote -v

Then you can use git push --all(**this --all is optional** ) remoteName  

then you add your files to your stagging area for the commit   
git add filename(for single file) or . or --all for everything  
git commit -m "to add a message to the commit"  
git push remoteName  

*git push --all allows a user to push all changes and not just a single commit or branch*


author: Mia Paulin
body: [@Craig Nodwell](/t5/user/viewprofilepage/user-id/3973516) Thanks! That helps out a lot!


author: Craig Nodwell
body: You're welcome.