Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how i take username and password from user in my java code through console using maven and jgit

Nupur Tiwari
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2018

public class git {


//public static Object textView;
//public static void main(String[] args) throws IOException,GitAPIException
//{


String repoUrl = "https://bitbucket_integration@bitbucket.org/bitbucket_integration/bitbucket_integration.git";
String cloneDirectoryPath = "G:\\tmp\\test1"; // Ex.in windows c:\\gitProjects\SpringBootMongoDbCRUD\

public void cloneRepo(String repoUrl, String cloneDirectoryPath, String User, String password) throws GitAPIException
{
try {
System.out.println("Cloning "+repoUrl+" into "+repoUrl);
Git.cloneRepository()
.setURI(repoUrl)
.setDirectory(Paths.get(cloneDirectoryPath).toFile())
.setCredentialsProvider( new UsernamePasswordCredentialsProvider(User,password ) )
.call();
System.out.println("Completed Cloning");

} catch (GitAPIException e) {
System.out.println("Exception occurred while cloning repo");
e.printStackTrace();
}
}

public static void main(String[] args) throws IOException,GitAPIException
{

}

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

Hi Nupur, this is a forum regarding Atlassian products. My recommendation for you to increase the chances to get a response, would be to post a more elaborated description with a clear message of what you want to obtain, the steps you followed so far and when is it failing, so users have it easier to understand what's going on and will be more likely to help you. 

Also, make sure to include info such as what platform are you using (Server or Cloud), version, which other tools are involved, etc.

If your message is not clear, users will most likely just skip your question and jump to the next one. 

Kind regards,

Ana 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events