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

How to push from Windows to remote

a_learner January 22, 2020

Hi

I have Bitbucket server running on an AWS ubuntu instance.  I have my local repo on my Windows laptop and I sync with a local VirtualBox ubuntu VM.  I can push and pull from the command line on ubuntu.  I am very at home on Linux so I have no issue with remotes, upstream and ssh keys.

However, I have no idea how to push/pull on the Windows command line.  

PS C:\> git branch -vv
* feature 34cd7bc [origin/feature: ahead 4] more git aliases
master 2e87266 [origin/master: ahead 1] config file updates

I am not logged onto Windows as the same user that I use on ubuntu that has access to bitbucket server.   How do I tell git on windows to connect as a specific user and tell it which private key to use?  I have loaded the private keys in pageant.

I have tried (note.  ip address redacted)

PS C:\> git push ssh://git@ec2-xx-xx-xxx-xxx.us-west-2.compute.amazonaws.com:7999/~git/project1.git

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Anyone?

Thanks

 

 

 

1 answer

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2020

If you are using SSH to connect to you Bitbucket repository you need to either reuse the key you have on Ubuntu, or generate a new one for Windows. Have a look at Set up an SSH key on how to do it on Windows.

a_learner January 23, 2020

Hi

Thanks, yes I get that I have to resuse my key and I do have my private key on Windows.  The bit of this puzzle that I am missing is how to tell the git command in Windows to use the private key which is in %userprofile%/.ssh/id_rsa.

Regards

A

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 23, 2020

It depends on how your profile is set up. If it defaults to %userprofile%, then just add the .ssh directory under there. If your IT have your user profile somewhere else then under c:\users you can find out where ssh is looking for the key by running this command:

ssh -vT <bitbucket URL>

Leave out the port number, and at the end of the output from ssh it will ask you to log on, just exit the command without doing that.

a_learner January 24, 2020

Hi Mikael

Thanks as per above my key is already here

%userprofile%/.ssh/id_rsa

I will test ssh later but I do not expect that to work because I do not have my public key on the bitbucket host.  I do not see why I would need it on the host.  I have of course  added the public key into my account in bucket server.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2020

Correct, the public key only has to be on the server you are pushing to from your client, that is how Bitbucket/SSH figures out that you are you, even if you are logged in as a different user on your windows machine.

dovidw February 4, 2020

I'm having a similar issue with Bitbucket Server. Is it possible that this has something to do with a recent security patch?

 

https://confluence.atlassian.com/bitbucketserver/bitbucket-server-security-advisory-2020-01-15-985498238.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events