DEV Community

Nuwan Arambage
Nuwan Arambage

Posted on

1

Github or Gitlab | Setup personal token to use automatically in git commands

I came across this trick which works for me pretty well. Our internal soure code repository migrated to gitlab from bitbucket. It was bit annoying to put username and personal token eveytime.

When I googled few times. I fould this trick and thought of sharing with the community.May be someone could get a help from this. There is another method as well. I have tried and tested only the first method. You could try out other method if you would like more secure way to keep your github personal token.

Method 01: Use ~/.netrc file

Step1: Open this ~/.netrc file 
    vim ~/.netrc

Step2: Addn following entry 
cat ~/.netrc
machine github.com login <login-id> password <token-password>   <-- sample entry 

cat  ~/.netrc
machine gitlab.wyoc.com login nuwana1 password sdp-A  <-- actual entry

Enter fullscreen mode Exit fullscreen mode

Method-02: Use credentials caching

Run below command in order 

    git config credential.helper store <-- This will ask your username and passwords and then remember it for future use. 

    git pull <--Please note running above commands will create a file at ~/.git-credentials and store the credentials in plain text which can be a security risk. 


Enter fullscreen mode Exit fullscreen mode

Note: An alternative is to store the credentials in memory rather than the disk. To do this you can run the below command.

git config credential.helper 'cache --timeout=3600'

Image of AssemblyAI tool

Challenge Submission: SpeechCraft - AI-Powered Speech Analysis for Better Communication

SpeechCraft is an advanced real-time speech analytics platform that transforms spoken words into actionable insights. Using cutting-edge AI technology from AssemblyAI, it provides instant transcription while analyzing multiple dimensions of speech performance.

Read full post

Top comments (0)

Image of Docusign

๐Ÿ› ๏ธ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

๐Ÿ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay