Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Technical Issue: Git hates me and won't let me push my repositories

Mia Paulin April 7, 2023

@mention 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?

 

1 answer

1 accepted

1 vote
Answer accepted
Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2023

Hi @Mia Paulin 

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

Mia Paulin April 7, 2023

@Craig Nodwell  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>

Mia Paulin April 7, 2023

I mean 

/*

git push -all <remote>

*/

Like Craig Nodwell likes this
Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2023

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 

Like Mia Paulin likes this
Mia Paulin April 7, 2023

@Craig Nodwell  Thanks!  That helps out a lot!

Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2023

You're welcome.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events