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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,284
Community Members
 
Community Events
184
Community Groups

ERR_FR_TOO_MANY_REDIRECTS while pushing files to bitbucket using nodejs

Edited
Aditya Shrivastava
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!
Mar 23, 2023
I am trying to push files to bitbucket repo using nodejs. Here is the code I am using
async function pushToRepo(remoteUrl, options, filePath, message) {
  try {
    // Reading file content from file path and encoding to base64 format
    const fileContent = fs.readFileSync(filePath);
    const base64Content = fileContent.toString('base64');

    const formData = new FormData();
    formData.append('message', message);
    formData.append('content', base64Content);
    formData.append('branch', options.branchName);

    const config = {
      headers: {
        ...formData.getHeaders(),
        'User-Agent': 'MyApp/1.0.0', // Optional, but recommended
      },
      auth: {
        username: options.username,
        password: options.password,
      },
      jar: true, // enabling cookie jar support
    };

    const resp = await axios.post(remoteUrl, formData, config);

    // Logging success message with response body
    console.log('Push to repo successful!', resp.body);
  } catch (err) {
    // Logging error message
    console.error('Error pushing to repo:', err);
  }
}

but it is showing

code: 'ERR_FR_TOO_MANY_REDIRECTS'

i got the remote url using

git remote get-url origin

and the url is

https://user_name@bitbucket.org/my-demo/helpcoin.git

password I am using generated from app password from bitbucket

and push is working in that but problem with commit as mentioned in question.

So using the code, in which I don't need to clone the whole repo

what is the issue in this? Am I missing something?

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events