It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to setup git command line to use ssh without password

Mark Ruedy Feb 26, 2015

I have a Stash repository and stash is setup to use https and ssh.  It has the site keys and I have registered my ~/.ssh/id_rsa.pub.   Using the web site works but do you have specific instructions for the steps to use git to communicate with the stash repository using either ssh:// or https:// without entering a password?

I am able to git clone but it always requires my password.

Thanks

3 answers

1 vote
Anurag Prakash Feb 26, 2015

You can use SourceTree client by Atlassian, it has option to save password for a repository.

Tools-> Option -> Authentication

SSH:

You need to add your public ssh key in the stash repository. Password will not be require if key is published.

HTTPS:

Trick: one way to update config file. But it is not recommended as it has security risk and password is visible when you push in git bash/gui in push statement.

$ vi <repo>/.git/config

[remote "origin"]
    url = http://username:password@stashurl/scm/<key>/repo.git    '<---- update your password here
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]

 

 

However Atlassian provide documentation:

https://confluence.atlassian.com/display/STASH/Permanently+authenticating+with+Git+repositories

 

Thanks,

Anurag Praksh

0 votes
Mark Ruedy Feb 26, 2015

I do have my id_rsa.pub registered on the server.  You're right, cloning with the servers recommended ssh://git@... url works.

I will take a look at the documentation, but I am still unable to get 'git clone https://username@server...' to work without entering my password.  Is that possible?

When I clone using ssh://git@servername will it have the correct user when I push?

Thanks

 

0 votes
Anurag Prakash Feb 26, 2015

If ssh is published/added to the repository and key is correct it will not ask for the password.

Repository --> settings -> Access Keys -> Add key

 

https requires Basic authentication (userID and Password). Atlassian only provided solution to store the password to get rid of this as mentioned in the https://confluence.atlassian.com/display/STASH/Permanently+authenticating+with+Git+repositories

I would recommend you to use SourceTree to avoid the problem (if you store password in SourceTree)

 

Thank you for your question.

 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,865 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you