Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9239477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:59:45+00:00 2026-06-18T07:59:45+00:00

I have written scripts for Windows and Linux to essentially set up a new

  • 0

I have written scripts for Windows and Linux to essentially set up a new users workspace with all the git repositories from our server.

I would like the user to enter the password for our server once, store it in a local variable, pass that variable to each git pull command, then erase the password variable and exit.

How can I input the password when the git pull command requests it? Both for Windows batch file and a Linux shell script.

Here is code from the Linux script:

#!/bin/bash

echo "Enter password: "
read pswd
clear #No screen peaking

#This is repeated for each repo
location=folderName
mkdir $location
cd $location
git init
git remote add origin git@<server>:$location.git
git pull origin master 
#Above prompts for password & is where I want to automatically input $pswd

I’ve tried various things recommended on SO and elsewhere, such as piping, reading from .txt file, etc. I would prefer to not need anything more than plain old windows cmd and Linux terminal commands. And as this script is just for set up purposes, I do not need to securely store the password permanently with something like ssh agent.

I’m running Windows 7 and Ubuntu 12.10, but this script is meant for setting up new users, so it should ideally work on most distributions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:59:46+00:00Added an answer on June 18, 2026 at 7:59 am

    I would really recommend to not try and manage that password step, and delegate that (both on Linux and Windows) to git credential helper.
    See:

    • “Git http – securely remember credentials“
    • “How to use git with gnome-keyring integration“

    The user will enter the password only once per session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written two scripts where one script calls subprocess.Popen to run a terminal
I have written some Python scripts in Eclipse where at some point I have
I have a number of manually written scripts (.sql) for tables, views and stored
I have written a script that fires a jQuery POST to retrieve data from
I have a perfectly functioning perl script (written in bash terminal on debian linux)
We have a windows master instance that writes data to Linux nodes, currently this
We have a requirement to design a monitoring application for our Windows client machines
We have a number of custom scripts that were written in VBScript for SDL
I have recently written a script in python that processes a Microsoft Windows DHCP
I have written a script on Windows 7 which keeps giving me an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.